what's wrong with this command?
#1

I all,i use EasyAdministration FS,i've a problem with the /giveweapon command.

When i use /giveweapon playerid weaponid ammo,he say this:

Код:
You have given the player WEAPONID PLAYERID AMMO
I've tried the command on myself and dont work..no weapon given..

Here is the command.

Код:
dcmd_giveweapon(playerid,params[])
{
	if(Player[playerid][admin] < 2){
	    return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to give weapons");
	}
	new pID,weapon,ammo;
	if(sscanf(params,"udd",pID,weapon,ammo)){
		return SendClientMessage(playerid,COLOR_RED,"USAGE: /giveweapon [playerid][weaponID] [ammo]");
	}
	if(!IsPlayerConnected(pID)){
	    return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
	}
	new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,aname,sizeof(aname));
	GetPlayerName(pID,name,sizeof(name));
	GivePlayerWeapon(pID,weapon,ammo);
	format(string,sizeof(string),"You have given the player %s weapon ID:%d with %d ammo",name,weapon,ammo);
    format(string2,sizeof(string2),"Admin %s has give you weapon ID:%d with %d ammo",aname,weapon,ammo);
    SendClientMessage(playerid,COLOR_GREEN,string);
    SendClientMessage(pID,COLOR_GREEN,string2);
	return 1;
}
Thanks
Reply
#2

No one can help me?
Reply
#3

no errors?
not sure about weapon and ammo btw try new weaponid; not that it makes difference i think....
im not experienced in dcmd....
but doesnt it need strval?
i see that at my gamemode that u need strval
Reply
#4

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
but doesnt it need strval?
i see that at my gamemode that u need strval
nah, sscanf doesnt need strval

Код:
if(sscanf(params,"udd",pID,weapon,ammo))
im not really sure, but maybe the "udd" should be "idd" but then u cant insert a part of the name anymore
or u could keep "udd" and define pID as a string, so
Код:
new pID[64];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)