23.01.2012, 13:21
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == "!")
{
if(AdminLevel[playerid] == 0) //aqui jб verifica se o 'playerid' nгo й admin
{
SendClientMessage(playerid, 0xFC4430AA,"Vocк nгo й um Administrador!");
return 1;
}
new tmp[128];
strmid(tmp, text, 1, strlen(text));
if(!strlen(tmp))
{
SendClientMessage(playerid, 0x0044E5FF, "Uso Correto: ! [texto]");
return 1;
}
for(new a=0; a < MAX_PLAYERS; a++)
{
if(IsPlayerConnected(a)) //verificou se o player 'a' estб conectado
{
if(AdminLevel[playerid] >= 1) //verificou se o 'playerid' й admin
{
new nome[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, nome, sizeof(nome));
format(str, sizeof(str), "[ Admin Chat ] %s diz: %s", nome[playerid], tmp);
SendClientMessage(a, 0xFF8000AA, str); //enviou a mensagem a todos os player 'a' conectados, sendo admins ou nгo
}
}
}
}
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == "!")
{
if(AdminLevel[playerid] == 0) //aqui jб verifica se o 'playerid' nгo й admin
{
SendClientMessage(playerid, 0xFC4430AA,"Vocк nгo й um Administrador!");
return 1;
}
new tmp[128];
strmid(tmp, text, 1, strlen(text));
if(!strlen(tmp))
{
SendClientMessage(playerid, 0x0044E5FF, "Uso Correto: ! [texto]");
return 1;
}
for(new a=0; a < MAX_PLAYERS; a++)
{
if(IsPlayerConnected(a)) //verificou se o player 'a' estб conectado
{
if(AdminLevel[a] >= 1) //verificou se o player 'a' й admin
{
new nome[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, nome, sizeof(nome));
format(str, sizeof(str), "[ Admin Chat ] %s diz: %s", nome[playerid], tmp);
SendClientMessage(a, 0xFF8000AA, str); //enviou a mensagem a todos os players 'a' conectados, que sгo admins
}
}
}
}
return 1;
}