Blocking a command - [L3th4l] - 03.01.2011
Well, i don't get this.
I have this:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success)
{
if(pInEvent{playerid} == 1) return 0;
}
return 1;
}
The problem is that i can still use commands
And yes, i have 'pInEvent{playerid}' defined in the correct places.
Re: Blocking a command -
Scenario - 03.01.2011
You sure you should have brackets, instead of whatever these are? [ and ]
should be
Re: Blocking a command - [L3th4l] - 03.01.2011
Quote:
Originally Posted by RealCop228
You sure you should have brackets, instead of whatever these are? [ and ]
should be
|
That's not it, and it should be like that.
Re: Blocking a command -
bigcomfycouch - 03.01.2011
pawn Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] )
{
if ( pInEvent{ playerid } )
{
SendClientMessage( playerid, 0xFF000000, "You cannot use commands whilst in an event!" );
return 0;
}
return 1;
}
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
return success;
}
Re: Blocking a command -
Sew_Sumi - 03.01.2011
Quote:
Originally Posted by [L3th4l]
That's not it, and it should be like that.
|
It is actually, Your coding isn't working, He's also told you where it is... Review it, and test it before saying it doesn't work
Код:
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || !pConcerned[i]) continue;
{
if(pDKCount[i] >= 20) // High Kills
Notice they use normal brackets and square brackets... You have { } in your code.
Your code... is wrong.
and this guys...
Quote:
Originally Posted by bigcomfycouch
pawn Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] ) { if ( pInEvent{ playerid } ) { SendClientMessage( playerid, 0xFF000000, "You cannot use commands whilst in an event!" ); return 0; } return 1; }
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { return success; }
|
is even wrong in the same area... Don't just copy paste and edit...
Re: Blocking a command -
iFriSki - 03.01.2011
Quote:
That's not it, and it should be like that.
|
You're trying to access an array's element.
PlayerID being the subscript. What RealCop posted is correct. Seeing as you had that wrong, did you declare the variable properly? Are you setting it properly as well?
Also, I thought you would want to return
true instead of false?
Re: Blocking a command - [L3th4l] - 03.01.2011
Quote:
Originally Posted by Sew_Sumi
It is actually, Your coding isn't working, He's also told you where it is... Review it, and test it before saying it doesn't work
Код:
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || !pConcerned[i]) continue;
{
if(pDKCount[i] >= 20) // High Kills
Notice they use normal brackets and square brackets... You have { } in your code.
Your code... is wrong.
and this guys...
is even wrong in the same area... Don't just copy paste and edit...
|
Edit:
Quote:
Originally Posted by bigcomfycouch
pawn Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] ) { if ( pInEvent{ playerid } ) { SendClientMessage( playerid, 0xFF000000, "You cannot use commands whilst in an event!" ); return 0; } return 1; }
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { return success; }
|
Straight to the point, thanks!
Re: Blocking a command -
leong124 - 03.01.2011
Not to mention whether using which bracket is correct,
OnPlayerCommandReceived calls instantly when a player types a command(even if it's not exist)
OnPlayerCommandPerformed is called after searching for the commands,
and the success value is the value returned in that command(or is 0 when not found).
Re: Blocking a command -
Sew_Sumi - 09.01.2011
Quote:
Originally Posted by [L3th4l]
Straight to the point, thanks!
|
Stop using the squiggly brackets, and use the proper ones like we said. You can find time to post a goddamn animated gif, but you can't read your own code
WTF?
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success)
{
if([b]pInEvent{playerid} == 1[/b]) return 0;
}
return 1;
}
See, That bold piece, That's where your issue is, and it's because you use the { } brackets and not the ( ).
Re: Blocking a command -
John_F - 09.01.2011
Maybe he's not using it for an array? Ever think of that? -.-"