Problem with my command.
#1

Hello Guys,

I've got a problem with this command, i don't know how to use the weapon names instead of weapon id's.
(Actually this is a command for my "Weapon Dealer" job)

pawn Код:
if(strcmp(cmd, "/givegun", true) == 0)
    {
    if(PlayerInfo[playerid][Job] == WeaponDealer)
    {
   
    new color1, color2;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "Usage: /givegun <playerid> <weapon name>");
    color1 = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "Usage: /givegun <playerid> <weapon name>");
    color2 = strval(tmp);
   
    GetPosition;
    if(!IsPlayerInRangeOfPoint(color1,5,x,y,z)) return Msg(playerid,COLOR_RED,"* This player is not in your location!");
   
    if(color2 < 1 || color2 > 5 ) return Msg(playerid,COLOR_RED,"* Invalid Weapon ID!");
   
    if(color2 == 1)
    {
    if(PlayerInfo[playerid][Materials] < 350) return Msg(playerid,COLOR_RED,"* You don't have enough materials!");
    PlayerInfo[playerid][Materials] -= 350;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    GivePlayerWeapon(color1,22,999999);
    format(string,sizeof(string),"You've got a 9mm from %s",pName); Msg(color1,COLOR_RED,string);
    Msg(playerid,COLOR_RED,"* You've created a Weapon and gave it away!");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"* You are not a Weapon Dealer!");
    }
    return 1;
    }
I wanna change this, but don't know how:
pawn Код:
if(color2 == 1) to: if(strcmp(****,"9mm",true)==1)
Please help me with this command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)