also need help with law caht
#1

when player does /lc nobody in law doesnt get a message
pawn Код:
CMD:lc(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        if(isnull(params)) return SendClientMessage(playerid,orange,"USAGE: /lc [message]");
        GetPlayerName(playerid,Nam,sizeof(Nam));
        format(str,sizeof(str),"[LAWCHAT] %s: %s",Nam,params);
        for(new i = 0; i < MAX_PLAYERS; ++i)
        {
            if(!IsPlayerConnected(i) && !IsPlayerNPC(i))
            {
                if(PlayerData[i][IsLaw] == 1)
                {
                    SendClientMessage(i,COLOR_BLUE,str);
                }
            }
        }
    }
    else return 0;
    return 1;
}
Reply
#2

Its quite simple

if(!IsPlayerConnected(i)
You are not checking if the player is connected

pawn Код:
CMD:lc(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        if(isnull(params)) return SendClientMessage(playerid,orange,"USAGE: /lc [message]");
        GetPlayerName(playerid,Nam,sizeof(Nam));
        format(str,sizeof(str),"[LAWCHAT] %s: %s",Nam,params);
        for(new i = 0; i < MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i))
            {
                if(PlayerData[i][IsLaw] == 1)
                {
                    SendClientMessage(i,COLOR_BLUE,str);
                }
            }
        }
    }
    else return 0;
    return 1;
}
I fixed it above
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)