06.08.2011, 16:40
ZCMD
PHP Code:
COMMAND:givemoney(playerid, params[])
{
new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
if (APlayerData[playerid][LoggedIn] == true)
{
if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, 0xFF0000AA, "Utilizaзгo: \"/dargrana <jogador> <quantidade>\"");
else
{
if (IsPlayerConnected(OtherPlayer))
{
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
if (Money > 0)
{
// Check if the player has enough money
if (APlayerData[playerid][PlayerMoney] >= Money)
{
// Transfer the money
RewardPlayer(playerid, -Money, 0);
RewardPlayer(OtherPlayer, Money, 0);
// Let the other player know that he has received money
format(Msg, 128, "{00FF00}Vocк recebeu {FFFF00}$%i{00FF00} de {FFFF00}%s", Money, Name);
SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
// Let the player know he gave money to somebody else
format(Msg, 128, "{00FF00}Vocк deu {FFFF00}$%i{00FF00} ao {FFFF00}%s", Money, OtherName);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
PlayerFile_Save(playerid);
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Vocк nгo tem grana suficiente");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Tem de utilizar valores maiores do que 0");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O jogador nгo estб online");
}
}
else
return 0;
return 1;
}