pawn Код:
public OnPlayerUpdate(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, GetPlayerScore(playerid));
}
I figure that this script would start causing trouble if you had like ~100 players.
Actually, why not make it check for a change?
pawn Код:
new pOldScore[MAX_PLAYERS],
pNewScore[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
pNewScore[playerid] = GetPlayerScore(playerid);
if(pNewScore[playerid] != pOldScore[playerid])
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pNewScore[playerid]);
}
}
Or make it execute only if a certain amount of ticks is counted:
pawn Код:
new playerScoreTick[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
if(playerScoreTick[playerid] == 100)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, GetPlayerScore(playerid));
playerScoreTick[playerid] = 0;
}
else
{
playerScoreTick[playerid] = playerScoreTick[playerid] + 1;
}
}
Or the BEST way to make your score transfer into your amount of money or otherwise is to actually change the score/money when you change the money/score. You know what I mean, this would require no usage of OnPlayerUpdate, just make your:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
into
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerMoney(playerid, GetPlayerScore(playerid));