help me!
#6

So, the code you need is this

PHP код:
CMD:agiveweapon(playeridparams[])
{
    new 
targetidweaponammo;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFFFFFF"You are not an rcon admin!");
    if(
sscanf(params"udd"targetidweaponammo)) return SendClientMessage(playerid0xFFFFFF"Usage: /agiveweapon [playerid]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid0xFFFFFF"Player is not connected!");
    if(
weapon || weapon 46) return SendClientMessage(playeridCOLOR_RED"Valid weaponids are 1 - 46"); // Because weaponid 88 is not valid...
    
    
new string[75], pname[MAX_PLAYER_NAME]; // This is to get the TARGET name  (optional)
    
GivePlayerWeapon(targetidweaponammo); // This will give the weapon to the targetid
    
GetPlayerName(targetidpnameMAX_PLAYER_NAME); // This is to get the TARGETS name
    
format(stringsizeof string"%s has received the weapon!"pname); // format is to define a variable,  pname is the TARGETS name
    
SendClientMessage(playerid0xFFFFFFstring); // The player who committed the cmd, gets the message from the format above
    
SendClientMessage(targetid0xFFFFFF"You have received a weapon!"); // Why didn't I use format here either? well, because there's no variable to define
    
return 1;

I hope it works, as I didn't test it.
Reply


Messages In This Thread
help me! - by ahameed4755 - 18.09.2015, 21:14
Re: help me! - by Aliassassin123456 - 18.09.2015, 21:22
Re: help me! - by Andre02 - 18.09.2015, 21:25
Re: help me! - by saffierr - 18.09.2015, 22:32
Re: help me! - by Sew_Sumi - 19.09.2015, 00:35
Re: help me! - by saffierr - 19.09.2015, 01:10
Re: help me! - by ahameed4755 - 19.09.2015, 10:59
Re: help me! - by Andre02 - 19.09.2015, 11:16
Re: help me! - by jlalt - 19.09.2015, 11:29
Re: help me! - by Sew_Sumi - 19.09.2015, 21:27

Forum Jump:


Users browsing this thread: 3 Guest(s)