weapon name
#1

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?
Reply
#2

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!
Reply
#3

Thanks, I'll test it tomorrow. +rep anyways!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)