OnPlayerText problem
#1

I have this command for players to disable their global chat

PHP код:
CMD:togchat(playeridparams[])
{
    switch(
chattoggle[playerid])
    {
        case 
truechattoggle[playerid] = falseSendClientMessage(playerid0x00FF00FF"Chat enabled");
        case 
falsechattoggle[playerid] = trueSendClientMessage(playerid0x00FF00FF"Chat disabled");
    }
    return 
1;

OnPlayerText:
PHP код:
public OnPlayerText(playeridtext[])
{
    if(!
chattoggled)
    {
        return 
0;
    }
    else
    {
        return 
0;
    }
        if(
chattoggle[playerid])
    {
        return 
0;
    }
    else
    {
        return 
1;
    }

The problem is that the chat would still be enabled even after toggling the chat off

chattoggled as global var is used here
PHP код:
CMD:disablechat(playerid)
{
    if(
PlayerInfo[playerid][Admin] < 6) return SendClientMessage(playerid0xFF0000AA"You're not authorized to use that command!");
    if(
chattoggled)
    {
        
chattoggled false;
        
SendClientMessageToAll(0x00FFFFFF"AdmCmd: An administrator has disabled the chat");
    }
    else 
SendClientMessage(playerid0xFFFF00FF"Chat is already disabled");
    return 
1;
}
CMD:enablechat(playerid)
{
    if(
PlayerInfo[playerid][Admin] < 6) return SendClientMessage(playerid0xFF0000AA"You're not authorized to use that command!");
    if(!
chattoggled)
    {
        
chattoggled true;
        
SendClientMessageToAll(0x00FFFFFF"AdmCmd: An administrator has enabled the chat");
    }
    else 
SendClientMessage(playerid0xFFFF00FF"Chat is already enabled");
    return 
1;

When /disablechat is used, it disables the chat. but when /togchat is used, it doesn't
Reply


Messages In This Thread
OnPlayerText problem - by NealPeteros - 02.01.2018, 08:35
Re: OnPlayerText problem - by JesterlJoker - 02.01.2018, 08:40
Re: OnPlayerText problem - by JaKe Elite - 02.01.2018, 08:47

Forum Jump:


Users browsing this thread: 3 Guest(s)