Need help with a /sellgun command. -
Can anyone figure out the problems? I've tried in different ways but now I'll let you try it. The command is supposed to work that if you do /sellgun [the id of the player] deagle it will give the selected player a deagle and all that shit. For some reason I'm getting errors so it would be nice with some help over here.
Код:
if(strcmp(cmd, "/sellgun", true) ==0)
{
if(PlayerInfo[playerid][LoggedIn] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0,-1052.366210, 1547.548217, 33.437610))
{
if(PlayerInfo[playerid][pJob] == 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "Usage: /sellgun [playerid] [Weaponid]");
new id = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, OOCCHAT,"---------------------------------------------------------");
SendClientMessage(playerid, COLOR_WHITE, "Deagle [250 mats] AK-47 [750 mats] MP5 [500 mats]");
SendClientMessage(playerid, COLOR_WHITE, "Colt [200 mats] Rifle [500 mats] Uzi [300 mats]");
SendClientMessage(playerid, COLOR_WHITE, "Tec9 [300 mats] Baseball Bat [50 mats] Knife [100 mats]");
SendClientMessage(playerid, COLOR_WHITE, "Armour [20 mats]");
SendClientMessage(playerid, COLOR_WHITE, "[ Usage: /sellgun [playerid] [Weaponname] ]");
SendClientMessage(playerid, OOCCHAT,"---------------------------------------------------------");
return 1;
}
new weapon = strlen(tmp);
if(IsPlayerConnected(id))
{
if(IsPlayerInRangeOfPoint(id, 5.0,-1052.366210, 1547.548217, 33.437610))
{
if(strcmp(weapon, "deagle", true) == 0)
{
if(PlayerInfo[playerid][Mats] >= 250)
{
PlayerInfo[playerid][Mats] = PlayerInfo[playerid][Mats] - 250;
GivePlayerWeapon(id, 24, 70);
new str[128];
format(str, sizeof(str), "*%s hands over a Deagle to %s.", pName(playerid), pName(id));
ProxDetector(30.0, playerid, str, MECHAT,MECHAT,MECHAT,MECHAT,MECHAT);
}
}
}
else{SendClientMessage(playerid, COLOR_RED, "The selected player is not in range of you.");}
}
else{SendClientMessage(playerid, COLOR_RED, "The selected players is not connected.");}
}
else{SendClientMessage(playerid, COLOR_RED, "You are not a materials dealer.");}
}
else{SendClientMessage(playerid, COLOR_RED, "You are not in range of the weapons dealing spot");}
}
else{SendClientMessage(playerid, COLOR_RED, "You need to be logged in to use this command.");}
return 1;
}
Edit: Problem allreayd solved LOL. I didn't notice my mats were below 250..
Re: Need help with a /sellgun command. -