17.05.2011, 12:27
Can example do
public Command(playerid, cmdtext[])
{
if (strcmp(cmd, "/drugtest", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "KORISTI: /drugtest [playerid/Dio Imena]");
return 1;
}
giveplayerid = ReturnUser(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(GetDistanceBetweenPlayers(playerid,giveplayerid ) < 3)
{
if(PlayerStoned[playerid] >= 1)
{
format(string, sizeof(string), "* %s je dao test na drogu igracu,a %s ga je stavio u usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Test na dorgu: Nadrogiran **");
GameTextForPlayer(playerid,"~w~Ovaj igrac je~n~~r~nadrogiran", 8000, 1);
return 1;
}
else
{
format(string, sizeof(string), "* %s je dao test na drogu igracu,a %s ga je stavio u usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Test na dorgu: Nije Nadrogiran **");
GameTextForPlayer(playerid,"~w~Ovaj igrac~n~~r~nije nadrogiran", 8000, 1);
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Igrac je offline !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Nisi ovlasten koristiti ovu komandu! (Cops Only)");
}
}
return 1;
}
or just
public Command() //without playerid and cmdtext[]
?
public Command(playerid, cmdtext[])
{
if (strcmp(cmd, "/drugtest", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "KORISTI: /drugtest [playerid/Dio Imena]");
return 1;
}
giveplayerid = ReturnUser(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(GetDistanceBetweenPlayers(playerid,giveplayerid ) < 3)
{
if(PlayerStoned[playerid] >= 1)
{
format(string, sizeof(string), "* %s je dao test na drogu igracu,a %s ga je stavio u usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Test na dorgu: Nadrogiran **");
GameTextForPlayer(playerid,"~w~Ovaj igrac je~n~~r~nadrogiran", 8000, 1);
return 1;
}
else
{
format(string, sizeof(string), "* %s je dao test na drogu igracu,a %s ga je stavio u usta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Test na dorgu: Nije Nadrogiran **");
GameTextForPlayer(playerid,"~w~Ovaj igrac~n~~r~nije nadrogiran", 8000, 1);
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Igrac je offline !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Nisi ovlasten koristiti ovu komandu! (Cops Only)");
}
}
return 1;
}
or just
public Command() //without playerid and cmdtext[]
?