weapon name - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: weapon name (
/showthread.php?tid=302618)
weapon name -
bartje01 - 09.12.2011
Hey. I want to know how to do the following.
I want that if you type this command you don't have to type the ID of the weapon but the name.
pawn Код:
if(sscanf(params,"ddd",id,weapon,price)) return SendClientMessage(playerid,-1,"{F81414}*Command Failed* {FFFFFF}Correct Usage: {00C0FF}/sellweapon [playerid] [weaponname] [price]");
Now it's like:
/sellweapon 0 24 1000
I want it like this:
/sellweapon 0 deagle 1000
How to do it?
Re: weapon name -
bartje01 - 09.12.2011
Wow, that looks really difficult right now xD
Could you please put it in my command so I can understand it better?
pawn Код:
COMMAND:sellweapon(playerid,params[])
{
new id, weapon, price;
if(sscanf(params,"ddd",id,weapon,price)) return SendClientMessage(playerid,-1,"{F81414}*Command Failed* {FFFFFF}Correct Usage: {00C0FF}/sellweapon [playerid] [weaponname] [price]");
if(Bit16_Get(g_Class,playerid) != 2) return SendClientMessage(playerid,-1,"{F81414}You're not a weapon dealer!");
if(!IsPlayerInRangeOfPlayer(3,playerid,id)) return SendClientMessage(playerid,-1,"{F81414}You're not close enough to this player!");
format(String,sizeof(String),"You've been offered a {00C0FF}%d {FFFFFF}for {6EF83C}$%d",weapon,price);
SendClientMessage(id,-1,String);
Selling[id] = playerid;
SellingPrice[id] = price;
SellingWeapon[id] = weapon;
return 1;
}
Thanks btw!
Re: weapon name -
bartje01 - 09.12.2011
Thanks, I'll test it tomorrow. +rep anyways!