[Help] Simple LITTLE question.
#3

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
This code: ( example )
pawn Код:
for( new i; i < MAX_PLAYERS; i ++ )
{
    if( IsPlayerConnected( i ) ) Kick( i );
}
is a replacement for
pawn Код:
if( IsPlayerConnected( 0 ) ) Kick( 0 );
if( IsPlayerConnected( 1 ) ) Kick( 1 );
if( IsPlayerConnected( 2 ) ) Kick( 2 );
if( IsPlayerConnected( 3 ) ) Kick( 3 );
//etc
if( IsPlayerConnected( 499 ) ) Kick( 499 );


I was trying to script an /a CMD for admin chat that when you excute it , it sends the text to all online admins , only admins .

This is what i got so far , not sure if this works but let's give it a shot .
pawn Код:
CMD:a(playerid, o[])
{
new aname[MAX_PLAYER_NAME],string[128];
if(PlayerInfo[playerid][pAdmin]<1) return SendClientMessage(playerid, -1, "You are not authorized to use this command!");
if(isnull(o)) return SendClientMessage(playerid, -1, "Usage: /a(dmin) [text]");
else
{
GetPlayerName(playerid, aname, sizeof(aname));

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin]>=1)
{
format(string, sizeof(string),"Admin %s: %s", aname, o);
SendClientMessage(PlayerInfo[i][pAdmin]>=1, -1, string);
SendClientMessage(playerid, -1, string);
}
}
}
}
return 1;
}
I'm not sure if i scripted it the right way using the "for(new i = 0; i < MAX_PLAYERS; i++)" , i don't get any error or warning after compling aswell , if something is wrong , few tips could be helpful , thanks .
Reply


Messages In This Thread
[Help] Simple LITTLE question. - by moadi - 06.10.2011, 17:50
Re: [Help] Simple LITTLE question. - by IstuntmanI - 06.10.2011, 18:24
Re: [Help] Simple LITTLE question. - by moadi - 06.10.2011, 18:28
Re: [Help] Simple LITTLE question. - by System64 - 06.10.2011, 18:52
Re: [Help] Simple LITTLE question. - by [HiC]TheKiller - 06.10.2011, 19:16
Re: [Help] Simple LITTLE question. - by Kingunit - 06.10.2011, 19:27
Re: [Help] Simple LITTLE question. - by spd_sahil - 06.10.2011, 19:41
Re: [Help] Simple LITTLE question. - by MoroDan - 06.10.2011, 19:55

Forum Jump:


Users browsing this thread: 4 Guest(s)