ZCMD Help. -
Zh3r0 - 22.09.2010
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...
Re: ZCMD Help. -
Vince - 22.09.2010
Quote:
Originally Posted by Zh3r0
pawn Код:
AllowedDMCommands[2][0] }
|
[0] ? Change to: []
Re: ZCMD Help. -
Zh3r0 - 22.09.2010
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...
Re: ZCMD Help. -
LarzI - 22.09.2010
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;
}
Re: ZCMD Help. -
Zh3r0 - 22.09.2010
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...
Re: ZCMD Help. -
LarzI - 22.09.2010
Actually, why not use string compare instead of string find?
Re: ZCMD Help. -
Zh3r0 - 22.09.2010
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.
Re: ZCMD Help. -
LarzI - 22.09.2010
Ah, forgot, lol
Re: ZCMD Help. -
Fj0rtizFredde - 22.09.2010
What if you change the ,false to ,true?
Re: ZCMD Help. -
Zh3r0 - 22.09.2010
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...