28.12.2012, 21:29
I made this command.
When I do /jetpack, it gives me a jetpack and it says: Administrator %s has given a jetpack to %s
When I do it again, It says: This player already has a jetpack.
When I do it again, It says: This player already has a jetpack.
But it repeats again. Administrator %s has given a jetpack to %s.
Code:
When I do /jetpack, it gives me a jetpack and it says: Administrator %s has given a jetpack to %s
When I do it again, It says: This player already has a jetpack.
When I do it again, It says: This player already has a jetpack.
But it repeats again. Administrator %s has given a jetpack to %s.
Code:
PHP код:
new Jetpack[MAX_PLAYERS];
CMD:jetpack(playerid, params[])
{
new targetid; new string[256]; new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name));
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid, COLOR_GOLD, "Usage: /jetpack [ID]");
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid player id");
if(Jetpack[targetid] == 0)
{
format(string, sizeof(string),"Administrator %s has given a jetpack to %s", Name, PlayerName(targetid));
SendClientMessageToAll(COLOR_GOLD, string);
GivePlayerJetpack(targetid);//Taken from a stock
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
Jetpack[targetid] = 1;
}
if(Jetpack[targetid] == 1) return SendClientMessage(playerid, COLOR_RED, "This player already has a Jetpack");
return 1;
}