SA-MP Forums Archive
How to disable a specific command - 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: How to disable a specific command (/showthread.php?tid=602276)



How to disable a specific command - Beasthian - 05.03.2016

SO how can i do it? lets say i want to dis able this command "/slap" making no admins use it, without going and removing the command from the script.


Re: How to disable a specific command - SickAttack - 05.03.2016

With a variable?
pawn Код:
new bool:gSlapDisabled = false;

CMD:disableslap(playerid, params[])
{
    gSlapDisabled = true;
    return 1;
}

CMD:slap(playerid, params[])
{
    if(gSlapDisabled)
    {
        return 0;
    }
    return 1;
}



Re: How to disable a specific command - Beasthian - 05.03.2016

Ok so can u make it for this command to be able to disable it

else if(strcmp(cmdtext, "/rcweaps", true) == 0)
{
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 27, 999);
GivePlayerWeapon(playerid, 31, 999);
PlayerPlaySound(playerid,1054,0,0,0);
return 1;
}


Re: How to disable a specific command - YouServ - 05.03.2016

new bool:tog_rcweaps;

else if(strcmp(cmdtext, "/rcweaps", true) == 0)
{
if(tog_rcweaps == true)
{
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 27, 999);
GivePlayerWeapon(playerid, 31, 999);
PlayerPlaySound(playerid,1054,0,0,0);
}
return 1;
}


else if(strcmp(cmdtext, "/tog_rcweaps", true) == 0)
{
if(tog_rcweaps == true) tog_rcweaps = false;
else tog_rcweaps = true;
return 1;
}