Is this right ?
#1

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;
}
Reply
#2

yes, but you miss weapon id ammo and who gave / receive

PHP код:
format(stringsizeof(string), "You have received %i weapon (ID) with %d ammo from %s"); 
to

PHP код:
format(stringsizeof(string), "You have received %i weapon (ID) with %d ammo from %s",weaponid,ammo,sendername); 
and
PHP код:
format(stringsizeof(string), "You have given %s %i weapon (ID) with %d ammo"); 
to
PHP код:
format(stringsizeof(string), "You have given %s %i weapon (ID) with %d ammo",receivername,weaponid,ammo); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)