Simple sscanf problem. showing weird id
#1

Hey guys. So, I got this problem now. I made a simple command which lets people give other people weapons. The problem is that whenever this happens, the script is supposed to sendclientmessage to both playerid and targetid that what weapon id they got, and stuff like that(see simple code for examples). instead of the code writing something like "you got weaponn 24 with 100 bullets', it says something like "you got weapon 2398472934723 with 12931202914" bullets.
Thank you

Код:
CMD:giveweapon(playerid,params[])
{
		new targetid,weaponid,bullets;
		if(sscanf(params,"iii",targetid,weaponid,bullets))
		{
			  return SendClientMessage(playerid,COLOR_RED,"usage: /giveweapon [playerid] [weaponid] [bullets]");
        }
        if(!IsPlayerConnected(targetid))
        {
			  return SendClientMessage(playerid,COLOR_RED,"Invalid playerid.");
        }
        if(weaponid<1||weaponid>46)
        {
			  return SendClientMessage(playerid,COLOR_RED,"Invalid weapon id.");
        }
        if(bullets<1||bullets>1000)
        {
			  return SendClientMessage(playerid,COLOR_RED,"Invalid number of bullets. Max: 1000.");
        }
        GivePlayerWeapon(targetid,weaponid,bullets);
        SendClientMessage(playerid,COLOR_GREEN,"You have given %i weapon with id %i and %i bullets.",targetid,weaponid,bullets);
        SendClientMessage(targetid,COLOR_GREEN,"You have recieved weapon id %i with %i bullets.",weaponid,bullets);
        return 1;
}
Reply


Messages In This Thread
Simple sscanf problem. showing weird id - by Sam5513 - 09.11.2012, 12:41
Re: Simple sscanf problem. showing weird id - by Glad2BeHere - 09.11.2012, 12:48
Re: Simple sscanf problem. showing weird id - by Sam5513 - 09.11.2012, 13:00
Re: Simple sscanf problem. showing weird id - by Glad2BeHere - 09.11.2012, 13:14
Re: Simple sscanf problem. showing weird id - by park4bmx - 09.11.2012, 13:27

Forum Jump:


Users browsing this thread: 1 Guest(s)