29.10.2015, 09:06
Hello. I wanted to create a command /givegun targetID weaponID ammo. Also with SendClientMessage. Is the following correct ?
Код:
COMMAND:givegun(playerid, params[]) { new toplayerid, weaponid, ammo, sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME], string[128]; if(sscanf(params, "uii", toplayerid, weaponid, ammo)) return SendClientMessage (playerid, 0xAA3333AA, "ERROR : Correct usage is /givegun [playerid] [weaponid] [ammo])" ); GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(toplayerid, receivername,sizeof(receivername)); format(string, sizeof(string), "You have received %i weapon (ID) with %d ammo from %s"); SendClientMessage(toplayerid, 0xFFFFFFAA, string); format(string, sizeof(string), "You have given %s %i weapon (ID) with %d ammo"); SendClientMessage(playerid, 0xFFFFFFAA, string); GivePlayerWeapon(toplayerid, weaponid, ammo); return 1; }