SA-MP Forums Archive
Disable chat for player - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disable chat for player (/showthread.php?tid=231319)



Disable chat for player - sim_sima - 25.02.2011

Hello guys. I have made an AFK system filterscript.
It has a /goafk and a /back command.
When the player types /goafk, i want to disable the chat for him, so the only thing he can type is /back. If he types anything esle, it sends him a client message.

Hope someone can tell me how to do that. Thank you.


Re: Disable chat for player - Libra_PL - 25.02.2011

Add in top of script:

Code:
new afkmsg[MAX_PLAYERS]
In /goafk command add:

Code:
afkmsg[playerid] = 1;
In /back command add:

Code:
afkmsg[playerid] = 0;
In OnPlayerText add:

Code:
if(afkmsg[playerid != 0) return SendClientMessage(playerid,0xFF0000FF,"You must to type /back before talking!");
Not sure, not tested.


Re: Disable chat for player - sim_sima - 25.02.2011

Thank you very much, guys!


Re: Disable chat for player - sim_sima - 25.02.2011

Quote:
Originally Posted by Libra_PL
View Post
Add in top of script:

Code:
new afkmsg[MAX_PLAYERS]
In /goafk command add:

Code:
afkmsg[playerid] = 1;
In /back command add:

Code:
afkmsg[playerid] = 0;
In OnPlayerText add:

Code:
if(afkmsg[playerid != 0) return SendClientMessage(playerid,0xFF0000FF,"You must to type /back before talking!");
Not sure, not tested.
Thank you, but it says "Undefined symbol: MAX_PLAYERS"


Re: Disable chat for player - sim_sima - 25.02.2011

Quote:
Originally Posted by Libra_PL
View Post
Add in top of script:

Code:
new afkmsg[MAX_PLAYERS]
In /goafk command add:

Code:
afkmsg[playerid] = 1;
In /back command add:

Code:
afkmsg[playerid] = 0;
In OnPlayerText add:

Code:
if(afkmsg[playerid != 0) return SendClientMessage(playerid,0xFF0000FF,"You must to type /back before talking!");
Not sure, not tested.
Here is the exact error message:
Quote:

C:\Users\Simon\Desktop\min gamle dm server\filterscripts\afkmode.pwn(12) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Simon\Desktop\samp server\pawno\include\core.inc(12) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Simon\Desktop\min gamle dm server\filterscripts\afkmode.pwn(111) : error 001: expected token: "]", but found ")"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Line 12 is the
pawn Code:
new afkmsg[MAX_PLAYERS]
And line 111 is the
pawn Code:
if(afkmsg[playerid != 0) return SendClientMessage(playerid, COLOR_NORMALRED, "( ! ) You can not chat while in AFK mode");
Thank you.

*UPDATE*

I fixed line 111, now the error msg is like this:
Quote:

C:\Users\Simon\Desktop\min gamle dm server\filterscripts\afkmode.pwn(12) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Simon\Desktop\samp server\pawno\include\core.inc(12) : error 009: invalid array size (negative, zero or out of bounds)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.




Re: Disable chat for player - Libra_PL - 25.02.2011

Sorry, my fail. Not "new afkmsg[MAX_PLAYERS]", but "new afkmsg[MAX_PLAYERS];" - I forgot the ";".


Re: Disable chat for player - sim_sima - 25.02.2011

Quote:
Originally Posted by [HLF]Southclaw
View Post
Well 'undefined symbol' what do you think you should do?
Define it!

#define MAX_PLAYERS x

where x is the number of player slots on your server

Or just put 'x' in the '[cell]'

for the second error, have you been editing the default includes? because core shouldn't give that error
Thank you very much!
I defined it, and there are no errors anymore.