ZCMD Help.
#1

So here is the problem, i want , that when i'm in a GM the following commands(Just an example, i can add more later)
/nrg /akill t be prohibited while in a DM.But since i use ZCMD i find it hard to make.

So is there any solution? I tried everything! with strfind strcmp i tried with loops and i tried with return 0 -1, but it gives me the messages that i'm not allowed to use the command BUT the command gets executed.

I've tried everything..

Here is what i have at the moment!

pawn Код:
AllowedDMCommands[2][0] =
    {
        {"/nrg"},{"/akill"}/*/setmyinterior /setmyworld /richlist /killslist /deathslist"
        "/mute /muteex /unmute /freeze /unfreeze /freezeex /warn /settime "
        "/setworld /setinterior /setweather /disarm /akill/sethealth /healall"
        "/setarmour /heal /setdrunk /car /carcolor /setplayergravity"
        "/setkills /setdeaths /setscore /givescore /setcash /givecash /setcookies /gethere /fu"
        "/taketo /givecar /setgravity /setvip"
        "/ban /kick /slapall /fuall"
        "/setall(kills|deaths|score|cash|cookies|time|weather|world|interior)"
        "/giveall(score|cash|cookies)"
        "/setlevel"
        "/vpm"*/

    };
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(P_DATA[ playerid ][ P_InDM ] == 1)
    {
            for(new i = 0; i < sizeof(AllowedDMCommands);i++)
            {
                //if( strfind(cmdtext, AllowedDMCommands[ i ][ 0 ], true) != -1) return -1;
                //IgnoreCommand(AllowedDMCommands[ i ][ 0 ])
                if( strfind(cmdtext, AllowedDMCommands[ i ][ 0 ], false) != -1)
                {
                    SCMLW(" NO NO ");
                }
            }
    }
return 1;
}
I would appreciate this VERY VERY much...
Reply
#2

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
pawn Код:
AllowedDMCommands[2][0]
}
[0] ? Change to: []
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
[0] ? Change to: []
I even tried without multiple commands, just a simple "/command" and it didn't worked...
The command kept being executed...
Reply
#4

pawn Код:
AllowedDMCommands[2][] =
    {
        {"/nrg"},{"/akill"}/*/setmyinterior /setmyworld /richlist /killslist /deathslist"
        "/mute /muteex /unmute /freeze /unfreeze /freezeex /warn /settime "
        "/setworld /setinterior /setweather /disarm /akill/sethealth /healall"
        "/setarmour /heal /setdrunk /car /carcolor /setplayergravity"
        "/setkills /setdeaths /setscore /givescore /setcash /givecash /setcookies /gethere /fu"
        "/taketo /givecar /setgravity /setvip"
        "/ban /kick /slapall /fuall"
        "/setall(kills|deaths|score|cash|cookies|time|weather|world|interior)"
        "/giveall(score|cash|cookies)"
        "/setlevel"
        "/vpm"*/

    };
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(P_DATA[ playerid ][ P_InDM ] == 1)
    {
            for(new i = 0; i < sizeof(AllowedDMCommands);i++)
            {
                //if( strfind(cmdtext, AllowedDMCommands[ i ], true) != -1) return -1;
                //IgnoreCommand(AllowedDMCommands[ i ])
                if( strfind(cmdtext, AllowedDMCommands[ i ], false) != -1)
                {
                    SCMLW(" NO NO ");
                }
            }
    }
return 1;
}
Reply
#5

I tried with this
pawn Код:
if( strfind(cmdtext, "/nrg", false) != -1)
                {
                    SCMLW(" NO NO ");
                }
DIDN'T WORK, the command got executed...If i put return 0, same! Gets executed + the Unknown Command message...

This is really pissing me off...
Reply
#6

Actually, why not use string compare instead of string find?
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Actually, why not use string compare instead of string find?
strcmp?
Well because i have parameters in the command, for example, "/akill" it has /akill <id>

So it's not an option, strfind would have been the best option...I would love to see ZeeX's answer or someone with high pawn knowledge...

But your effort is really appreciated, by just trying to help you prove to be good.
Reply
#8

Ah, forgot, lol
Reply
#9

What if you change the ,false to ,true?
Reply
#10

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
What if you change the ,false to ,true?
When i said i tried everything, i meant I TRIED EVERY SINGLE FREAKIN TRUE FALSE 1, 0 , -1 != ...

There must be something that stops it, something that checks BEFORE the command gets executed...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)