01.11.2015, 05:47
(
Последний раз редактировалось TitanZ; 26.11.2015 в 08:13.
)
I have a problem on this script, This is very detrimental please help me
**
if the sender gives the money to another player, no problem
however, if the sender gives the money to another player, then the sender leaving the server, the money sender is not reduced, but the money sent to the player targeted
**
if the sender gives the money to another player, no problem
however, if the sender gives the money to another player, then the sender leaving the server, the money sender is not reduced, but the money sent to the player targeted
PHP код:
CMD:givemoney(playerid,params[]) {
new moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playermoney[MAX_PLAYERS],string[128];
if (sscanf(params, "ud",giveplayerid, moneys)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FF9900}[USAGE]:- {FFFFFF}/givemoney {FFFF00}[playerid] [amount]");
// if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney[playerid] = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney[playerid] >= moneys) {
GivePlayerMoney(playerid, (-moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "{FFFFFF}You Have Sent {FFFF00}%s [%d], {33CC33}$%d", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "{FFFFFF}You have received {33CC33}$%d {FFFFFF}From {FFFF00}%s [%d]", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GREEN, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_BRIGHTRED, "{FF9900}[BANK]:- {FFFFFF}Invalid transaction amount");
}
}
else {
format(string, sizeof(string), "{FFFF00}[ID:%d] {FFFFFF}Player not connected!", giveplayerid);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
}
return 1;
}