SA-MP Forums Archive
Cant use Chat ...[in game] - 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: Cant use Chat ...[in game] (/showthread.php?tid=399672)



Cant use Chat ...[in game] - M3mPHi$_S3 - 15.12.2012

hey guy's .... how are you all ? so i got an problem here is the code like
PHP код:
public OnPlayerText(playerid)
{
    if(
AFK[playerid] == 1)return GameTextForPlayer"You cant chat while in afk mode",3000,3);
    return 
0;

This is just my code and i am using lordz afk system so the problem is that when i am in afk so i cant chat but after i get /back again i cant chat ... wtf ...


Re: Cant use Chat ...[in game] - Lordzy - 15.12.2012

Well I'm sorry I think it's becoming because of a mistake in defines, I guess. Here's my chat stuffs of L-AFK.
As same as written on L-AFK:
pawn Код:
#define Disable_AFKCHAT == true //Change it from true to false if you don't want AFK users to be restricted in Chatting.

#if defined Disable_AFKCHAT == true
public OnPlayerText(playerid)
{
    if(AFK[playerid] == 1)
    {
     SendClientMessage(playerid, red, "You cannot chat while you are in AFK.");
    }
    return 0;
}
#endif
Please change the define to:
pawn Код:
#define Disable_AFKCHAT true
And also, make sure that the AFK variable is set to 0 on /back command.


Re: Cant use Chat ...[in game] - M3mPHi$_S3 - 15.12.2012

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Well I'm sorry I think it's becoming because of a mistake in defines, I guess. Here's my chat stuffs of L-AFK.
As same as written on L-AFK:
pawn Код:
#define Disable_AFKCHAT == true //Change it from true to false if you don't want AFK users to be restricted in Chatting.

#if defined Disable_AFKCHAT == true
public OnPlayerText(playerid)
{
    if(AFK[playerid] == 1)
    {
     SendClientMessage(playerid, red, "You cannot chat while you are in AFK.");
    }
    return 0;
}
#endif
Please change the define to:
pawn Код:
#define Disable_AFKCHAT true
And also, make sure that the AFK variable is set to 0 on /back command.
you mean change
PHP код:
#if defined Disable_AFKCHAT == true 
into
PHP код:
#if defined Disable_AFKCHAT true 



Re: Cant use Chat ...[in game] - Lordzy - 15.12.2012

Not that '#if'. At the top of the script, it has some defines. There you can see a define like this:
pawn Код:
#define Disable_AFKCHAT == true //Change it from true to false if you don't want AFK users to be restricted in Chatting.
Change it to:
pawn Код:
#define Disable_AFKCHAT true



Re: Cant use Chat ...[in game] - Sinner - 15.12.2012

If you return 0 under OnPlayerText the text will not be shown, change it to 1.


Re: Cant use Chat ...[in game] - Mean - 15.12.2012

pawn Код:
public OnPlayerText(playerid)
{
    if(AFK[playerid] == 1) return GameTextForPlayer, "You cant chat while in afk mode",3000,3), 0; // NOTICE THE ZERO I ADDED HERE - IT PREVENTS AFK PLAYERS FROM CHATTING
    return 1; // If a player isn't afk, message gets sent
}
You were returning 0 no matter happens...


Re: Cant use Chat ...[in game] - Lordzy - 15.12.2012

-removed-.


Re: Cant use Chat ...[in game] - M3mPHi$_S3 - 15.12.2012

Nah man ... i set it to 1 i mean i tried but it will allow you to chat in game as well and while in afk as well.i'm saying that it is not showing it is showing but not letting me to chat before and after afk.


Re: Cant use Chat ...[in game] - Lordzy - 15.12.2012

Try using the code Mean given, it seems to work well.


Re: Cant use Chat ...[in game] - Mean - 15.12.2012

Quote:
Originally Posted by мυ∂υℓ_вacнα
Посмотреть сообщение
Nah man ... i set it to 1 i mean i tried but it will allow you to chat in game as well and while in afk as well.i'm saying that it is not showing it is showing but not letting me to chat before and after afk.
Use my code, I added a 0 after the format so it returns 0 on AFK and 1 on anything else...

I even wrote "NOTICE THE ZERO" with caps in my code!