29.01.2014, 12:08
This is a part of: ASI
A.S.F.F.F.$1.D.O.D - R.F.A.S
IntroductionA.S.F.F.F.$1.D.O.D - R.F.A.S
Hello everyone. I made a very simple include for a small fix. When I was developing a game-mode script for my server, I experienced a problem; whenever I got money greater than $100, then on death, the money gets wiped off by -100! I have a friend who was also experiencing this problem from over a year!, but he couldn't find the solution. Imagine 1 year! He said he searched help topic related to this problem but there were no solutions. So, I came with a idea! I developed a very simple include (or a code) which actually does not prevent GTA SA from inter-faring on death and taking -100, but, it resets the player's money before his spawn, then saves the money he last had in a variable as a integer. Then when the player spawns, it gives the player the same unmodified money! The no.2 purpose for this small, simple source is that many server owners, OR, below average scriptwriters, OR, average scriptwriters aren't aware of this (If they had ever experienced this!).
__________________________________________________ ______________________________
Source
Here is the code down. You too can put this code directly in your mode, OR, making a separate include file (".inc") is optional.
pawn Код:
new LastM_@i[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, LastM_@i[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
LastM_@i[playerid] = GetPlayerMoney(playerid);
return 1;
}