01.06.2012, 12:41
No, the problem is not loading and saving money, this works as it has to.
However, if the player joins the server and purchases and item, like a car, the money only gets removed serverside(/stats) and not serverside (cash at the right top)
This is a part where the player has to lose clientside money:
However, if the player joins the server and purchases and item, like a car, the money only gets removed serverside(/stats) and not serverside (cash at the right top)
This is a part where the player has to lose clientside money:
pawn Код:
command(pay, playerid, params[])
{
new id, plmoney, string[128];
if(sscanf(params, "ud", id, plmoney))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pay [playerid] [amount]");
}
else
{
if(Player[playerid][Money] >= plmoney)
{
if(IsPlayerConnectedEx(id) || id != playerid)
{
if(Spectator[id][SpecSpectatingPlayer] != -1)
{
SendClientMessage(playerid, WHITE, "You're too far away.");
}
else
{
if(plmoney > 0 && plmoney < 20000)
{
if(GetDistanceBetweenPlayers(playerid, id) < 5)
{
Player[playerid][Money] -= plmoney;
Player[id][Money] += plmoney;
format(string, sizeof(string), "You have paid $%s to %s.", IntToFormattedStr(plmoney), GetName(id));
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "* %s has paid %s some money ($%s).", GetName(playerid), GetName(id), IntToFormattedStr(plmoney));
NearByMessage(id, NICESKY, string);
new tmpip1[128], tmpip2[128];
GetPlayerIp(playerid, tmpip1, sizeof(tmpip1));
GetPlayerIp(id, tmpip2, sizeof(tmpip2));
new hour, minute, second, day, year, month;
gettime(hour, minute, second);
getdate(year, month, day);
format(string, sizeof(string), "[PAY] %s (IP: %s) has paid %s (IP: %s) $%s on %d/%d/%d (%d:%d:%d)", GetName(playerid), tmpip1, GetName(id), tmpip2, IntToFormattedStr(plmoney), day, month, year, hour, minute, second);
MoneyLog(string);
format(string, sizeof(string), "You have been paid $%s, by %s.", IntToFormattedStr(plmoney), GetName(playerid));
SendClientMessage(id, WHITE, string);
if(Player[playerid][PlayingHours] == 0 && plmoney >= 999 && Player[playerid][AdminLevel] < 1)
{
format(string, sizeof(string), "WARNING: %s may possibly be money-farming, they've given $%s to %s (w/ 0 playing hours)", GetName(playerid), IntToFormattedStr(plmoney), GetName(id));
SendToAdmins(ADMINORANGE, string, 0);
}
}
else
{
SendClientMessage(playerid, WHITE, "You're too far away.");
}
}
else
{
SendClientMessage(playerid, WHITE, "You can't pay under $1, or over $19,999.");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "Player not connected or not logged in, or is you.");
}
}
}
return 1;
}