/sellweapon? +REP!!! - 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: /sellweapon? +REP!!! (
/showthread.php?tid=422907)
/sellweapon? +REP!!! -
Lynet - 15.03.2013
Do anyone know here why I can't add new cmds to LuxAdmin? Its the newest version and tried to do this:
PHP код:
dcmd_sellweapon(playerid,params[])
{
if(AccInfo[playerid][Dealer] >= 1)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
new tmp3[256]; tmp3 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return
SendClientMessage(playerid, -1, "Usage: /sellweapon [PlayerID] [Weapon ID/Name] [Ammo]") &&
if(IsPlayerInRangeOfPoint(id, 5.0,-1052.366210, 1547.548217, 33.437610))
new player1 = strval(tmp);
new weap, ammo, WeapName[32];
new string[128];
if(!strlen(tmp3) || !IsNumeric(tmp3) || strval(tmp3) <= 0 || strval(tmp3) > 99999) ammo = 500;
else ammo = strval(tmp3);
if(!IsNumeric(tmp2)) weap = GetWeaponIDFromName(tmp2);
else weap = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(!IsValidWeapon(weap))
return SendClientMessage(playerid,red,"ERROR: Invalid Weapon ID");
SendCommandToAdmins(playerid,"GiveWeapon");
GetWeaponName(weap,WeapName,32);
format(string, sizeof(string), "|- You have given \"%s\" a %s (%d) with %d rounds of Ammo -|", PlayerName2(player1), WeapName, weap, ammo);
SendClientMessage(playerid,-1,string);
if(player1 != playerid)
{
format(string,sizeof(string),"GunDealer %s has given you a %s (%d) with %d rounds of Ammo", PlayerName2(playerid), WeapName, weap, ammo);
SendClientMessage(player1,red,string);
}
return GivePlayerWeapon(player1, weap, ammo);
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}
I get no errors, or anything but when I try to do the cmd IG, it wont work? Any issues on this? And yes, I putted this in my enum.
Re: /sellweapon? +REP!!! - Patrick - 15.03.2013
can you show us your define on that command?
you should have something like this on your callback
OnPlayerCommandText
pawn Код:
dcmd(sellweapon,10,cmdtext);
if you dont have that. make sure you have that.
or if it still give's you error IG i prefer using
sscanf
Re : /sellweapon? +REP!!! -
morocco - 15.03.2013
http://pastebin.com/KDAgKg9A