04.06.2011, 18:57
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[128];
cmd = strtok(cmdtext, idx);
if (strcmp("/dargrana", cmdtext, true, 10) == 0 && IsPlayerAdmin(playerid))
{
new tmp[128], tmp2[128];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Use: /dargrana [ID] [Quantia]");
return 1;
}
if(!strlen(tmp2))
{
SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Use: /dargrana [ID] [Quantia]");
return 1;
}
new recebedor, quantia;
recebedor = strval(tmp);
quantia = strval(tmp2);
if(IsPlayerConnected(recebedor))
{
new string[128], string2[128], pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
GetPlayerName(recebedor, pname, MAX_PLAYER_NAME);
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(string, 128, "O Admin %s deu R$%d para vocк!", aname, quantia);
format(string2, 128, "Vocк enviou R$%d para o jogador %s", pname, quantia);
SendClientMessage(playerid, 0xFFFF00FF, string2);
SendClientMessage(recebedor, 0xFFFF00FF, string);
GivePlayerMoney(recebedor, quantia);
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador nгo encontrado!");
return 1;
}
return true;
}
return 0;
}
