SA-MP Forums Archive
[QUESTION/HELP] - 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: [QUESTION/HELP] (/showthread.php?tid=246711)



[QUESTION/HELP] - bijoyekuza - 05.04.2011

Hey scripters.
so I have this command

pawn Код:
if(strcmp(cmd,"/back",true) == 0)
    {
        if(PlayerInfo[playerid][pCop] < 1) return SendClientMessage(playerid,COLOR_AFOR,"idiot !");
        if(PlayerInfo[playerid][pCop] > 0)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(PlayerInfo[i][pCop] > 0 && i != playerid)
                {
                    SendClientMessage(i,COLOR_BLUE,"Wassaup nigga!");
                }
            }
        }
        return 1;
    }
so im a cop.
I want that when I use this command and im a cop it will sendclientmessage to every cop in the game, exept me.
so will this work ?
if(PlayerInfo[i][pCop] > 0 && i != playerid)




Re: [QUESTION/HELP] - Sascha - 05.04.2011

why don't you just try it? lol
well it will work however I'd suggest you to use "IsPlayerConnected" in the loop, too..
like this:
pawn Код:
if(strcmp(cmd,"/back",true) == 0)
    {
        if(PlayerInfo[playerid][pCop] < 1) return SendClientMessage(playerid,COLOR_AFOR,"idiot !");
        if(PlayerInfo[playerid][pCop] > 0)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pCop] > 0 && i != playerid)
                    {
                        SendClientMessage(i,COLOR_BLUE,"Wassaup nigga!");
                    }
                }
            }
        }
        return 1;
    }



Re: [QUESTION/HELP] - Markx - 05.04.2011

Racist shit.


Re: [QUESTION/HELP] - -Rebel Son- - 05.04.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
why don't you just try it? lol
well it will work however I'd suggest you to use "IsPlayerConnected" in the loop, too..
like this:
pawn Код:
if(strcmp(cmd,"/back",true) == 0)
    {
        if(PlayerInfo[playerid][pCop] < 1) return SendClientMessage(playerid,COLOR_AFOR,"idiot !");
        if(PlayerInfo[playerid][pCop] > 0)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pCop] > 0 && i != playerid)
                    {
                        SendClientMessage(i,COLOR_BLUE,"Wassaup nigga!");
                    }
                }
            }
        }
        return 1;
    }
Try FP's code, Looks good.

@markx Dont post useless posts.