28.12.2012, 12:36
pawn Код:
if(strcmp(cmd, "/a", true) == 0 || strcmp(cmd, "/chat", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo pode usar esse comando!");
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid,-1,"Use:{FFFFFF} /a [Texto]");
format(string, sizeof(string), "{FF4500}%s diz: {FFFFE0}%s", sendername,tmp);
ChatAdmin(-1, string);
return 1;
}
Tipo, com o nнvel 5 e 6 as cores no chat diferenciadas dos nнveis abaixo.
pawn Код:
if(strcmp(cmd, "/espiar", true) == 0 || strcmp(cmd, "/tv", true) == 0)
{
GetPlayerName(playerid, nome, sizeof nome);
if(PlayerInfo[playerid][Level] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[ADMIN] /TV [playerid/Parte-do-Nick]");
return 1;
}
if(!IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Jogador nгo conectado");
return 1;
}
if(playerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, " Nгo й possнvel se espiar.");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string), "Vocк estб espiando %s (ID: %d)",playerid);
SendClientMessage(playerid, COLOR_WHITE, string);
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playerid), SPECTATE_MODE_NORMAL);
Espiando[playerid] = 1;
return 1;
}
else
{
format(string, sizeof(string), "Vocк estб espiando %s (ID: %d)",playerid);
SendClientMessage(playerid, COLOR_WHITE, string);
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, playerid, SPECTATE_MODE_NORMAL);
Espiando[playerid] = 1;
}
}
return 1;
}