command problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command problem (
/showthread.php?tid=167408)
command problem -
jaksimaksi - 12.08.2010
hi, im making a command /swap, i want that with this command i can disable enable one thing, but when i type /swap i got a sign that command have been turned on and server unknow command. when i type second time i got a sign auto swap turned off and auto swap turned on and server unknown command... whats the problem? here is the code:
dcmd_swap(playerid,params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not adminstrator");
if(Swapas == 0)
{
Swapas = 1;
SendClientMessage(playerid, COLOR_LIME, "Auto swap have been turned off");
}
if(Swapas == 1)
{
Swapas = 0;
SendClientMessage(playerid, COLOR_LIME, "Auto swap have been turned on");
}
return 1;
}
Please help me.
Re: command problem -
MadeMan - 12.08.2010
pawn Код:
dcmd_swap(playerid,params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not adminstrator");
if(Swapas == 0)
{
Swapas = 1;
SendClientMessage(playerid, COLOR_LIME, "Auto swap have been turned off");
}
else if(Swapas == 1) // <--------------- changed this line
{
Swapas = 0;
SendClientMessage(playerid, COLOR_LIME, "Auto swap have been turned on");
}
return 1;
}