SA-MP Forums Archive
Need to know if my code is right. - 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: Need to know if my code is right. (/showthread.php?tid=390128)



Need to know if my code is right. - Magic_Time - 04.11.2012

PHP код:
CMD:help(playerid, params[])
{
new 
MSG[250]
new 
Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
new 
mssg[250];
format(MSG,sizeof(MSG),"Player %s needs help:[Help Message: %s]", Name, mssg);
SendClientMessageToAdmins(GREEN, MSG);
return 
1;
//.................................
stock SendClientMessageToAdmins(color, text[])
    {
        for(new 
a, g = GetMaxPlayers(); a < g; a++)
            if(
IsPlayerConnected(a) && IsPlayerAdmin(a))
                
SendClientMessage(a, color, text);
    }
} 



Re: Need to know if my code is right. - Glad2BeHere - 04.11.2012

pawn Код:
stock SendClientMessageToAdmins(color, string[])
{
    foreach(Player, i)
    {
        if(IsPlayerConnected(i) && IsPlayerAdmin(i))
        {
            SendClientMessage(i, color, string);
        }
    }
    return 1;
}

SendClientMessageToAdmins(GREEN, MSG);