Problem: Ovako, poceo sam da sredjujem komande, pa sam uradio samo jednu da bi ste vi proverili da li valja. Molim vas recite mi da li je dobro. I imam pitanje jedno koje cu navesti ispod
Code:
YCMD
YCMD:alkotest(playerid,params[],help)
{
#pragma unused help
if(IsPlayerConnected(playerid))
{
if (IsACop(playerid))
{
if(sscanf(params,"u",giveplayerid)) return SCM(playerid, COLOR_GREY, "KORISCENJE: /alkotest [playerID/DeoImena]");
new level = GetPlayerDrunkLevel(giveplayerid);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 3)
{
if(level > 600)
{
format(string, sizeof(string), "* %s uzima uzima uredjaj za test alkohola i stavlja ga u %s'ova usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SCM(playerid, COLOR_LIGHTBLUE, "** Rezultat: Pozitivan **");
GameTextForPlayer(playerid,"~w~Ovaj igrac~n~~r~je pijan", 8000, 1);
return 1;
}
else
{
format(string, sizeof(string), "* %s uzima uzima uredjaj za test alkohola i stavlja ga u %s'ova usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SCM(playerid, COLOR_LIGHTBLUE, "** Rezultat: Negativan **");
GameTextForPlayer(playerid,"~w~Ovaj igrac~n~~r~nije pijan", 8000, 1);
return 1;
}
}
}
}
else
{
SCM(playerid, COLOR_GRAD1, " Ovaj igrac je offline !");
}
}
else
{
SCM(playerid, COLOR_GRAD1, " Niste ovlasceni da koristite ovu komandu! (Policajci samo)");
}
}
return 1;
}STRCMP
if (strcmp(cmd, "/breathtest", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /breathtest [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
new level = GetPlayerDrunkLevel(giveplayerid);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 3)
{
if(level > 600)
{
format(string, sizeof(string), "* %s grabs their breathalyzer and puts the tube into %s's mouth.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Breathalyzer Result: Intoxicated **");
GameTextForPlayer(playerid,"~w~This player is~n~~r~Drunk", 8000, 1);
return 1;
}
else
{
format(string, sizeof(string), "* %s grabs their breathalyzer and puts the tube into %s's mouth.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Breathalyzer Result: Not Intoxicated **");
GameTextForPlayer(playerid,"~w~This player is~n~~r~Not Drunk", 8000, 1);
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " This player is offline !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use this command! (Cops Only)");
}
}
return 1;
}PITANJE:
if(sscanf(params,"u",giveplayerid)) return SCM(playerid, COLOR_GREY, "KORISCENJE: /alkotest [playerID/DeoImena]");Zasto ovde ide return, to je ako ne ukuca broj tj parametar u onda mu ispisuje poruku koliko sam skapirao (prekopirao sam ovaj kod iz drugog moda)?
Koju vrednost return ima kad se stavi samo return ? 0?
