SA-MP Forums Archive
[ Pawn.CMD ] Blocking Commands - 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: [ Pawn.CMD ] Blocking Commands (/showthread.php?tid=662168)



[ Pawn.CMD ] Blocking Commands - IdonTmiss - 25.12.2018

I wanted to block all commands expect only one, I wanted to do it on the callback "OnPlayerCommandReceived" but can't get it to work, do I need to add code to every command that I want to block like "if(blabla) return blabla" or is there a way, Pawn.CMD even tho its in the title


Re: [ Pawn.CMD ] Blocking Commands - iorp - 25.12.2018

Try to use if condition, pass the command for selected only and for else return 0


Re: [ Pawn.CMD ] Blocking Commands - IdonTmiss - 25.12.2018

Quote:
Originally Posted by iorp
Посмотреть сообщение
Try to use if condition, pass the command for selected only and for else return 0
I tried it like this but it gives an error

PHP код:
    if((my code) && cmd != ban)
    {
        
SendClientMessage(playerid, -1"Error !");
        return 
0;
    }
// error 017: undefined symbol "ban" // 



Re: [ Pawn.CMD ] Blocking Commands - iorp - 25.12.2018

Quote:
Originally Posted by IdonTmiss
Посмотреть сообщение
I tried it like this but it gives an error

PHP код:
    if((my code) && cmd != ban)
    {
        
SendClientMessage(playerid, -1"Error !");
        return 
0;
    }
// error 017: undefined symbol "ban" // 
that is not a integer to compare, use
Код:
if(!strcmp("ban", cmdtext))



Re: [ Pawn.CMD ] Blocking Commands - IdonTmiss - 25.12.2018

Quote:
Originally Posted by iorp
Посмотреть сообщение
that is not a integer to compare, use
Код:
if(!strcmp("ban", cmdtext))
Hmm thanks for the advice but I figured it out, not using the strcmp or anything, but thanks anyway