28.05.2015, 14:45
se baseie no comando de dar dinheiro do PPC_Trucking, lembrando que o Pawn trabalha com 32Bytes, e ao chegar em 2.5kkk o dinheiro irб bugar!
PHP код:
COMMAND:dardinheiro(playerid, params[])
{
new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/dardinheiro", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, 0xFF0000AA, "Use: /dardinheiro [id] [quantia]");
else
{
// Check if the otherplayer is online
if (IsPlayerConnected(OtherPlayer))
{
// Get the player-names
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
// Check if the money has a positive value (to prevent stealing money using negative values)
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}Voce recebeu {FFFF00}R$%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}Voce deu {FFFF00}R$%i{00FF00} para {FFFF00}%s.", Money, OtherName);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Save the player-stats
PlayerFile_Save(playerid);
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce nao tem dinheiro suficiente.");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce deve usar valores maiores que 0.");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Esse jogador nao esta online.");
}
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}