08.05.2011, 21:06
(
Последний раз редактировалось Biesmen; 09.05.2011 в 17:04.
)
OnPlayerMoneyChange 2.0
Created by: Biesmen
About
Previously I made an include called OnPlayerEarnMoney and OnPlayerLoseMoney. After thinking wisely I came up with an conclusion that include wouldn't work properly as it should do. I decided to recreate it and rename it. The script is very easy to understand. The script will check the player's money once he spawns and store it in a variable. This will support servers who have a register/login system. If the player's money changes, negative or positive, it will call the callback "OnPlayerMoneyChange", with the amount that has been changed.
Version
Version 2.0
Change log:
Version 2.0
-Added one parameter to the callback: TotalAmount. This will return the money you have when the callback OnPlayerMoneyChange is being called.
-Modified a variable in the OnPlayerUpdate callback, in the include. Unnecessarily usage of MAX_PLAYERS is not needed.
How-to
Copy the script of the pastebin url.
Open a new notepad file. Paste the script you copied at the pastebin url.
Go to your GTA San Andreas server files folder.
Save the notepad file as OPMC.inc at /pawno/include.
In your gamemode/filterscript/script:
Type this at your includes list, at the top of your script:
Example script:
Download
Pastebin Version: 2.0
Pastebin Version: 1.0
No mirrors allowed!
Known bugs
None so far.
Feel free to post bugs on this section, if you found any.
Credits
Created by: Biesmen
About
Previously I made an include called OnPlayerEarnMoney and OnPlayerLoseMoney. After thinking wisely I came up with an conclusion that include wouldn't work properly as it should do. I decided to recreate it and rename it. The script is very easy to understand. The script will check the player's money once he spawns and store it in a variable. This will support servers who have a register/login system. If the player's money changes, negative or positive, it will call the callback "OnPlayerMoneyChange", with the amount that has been changed.
Version
Version 2.0
Change log:
Version 2.0
-Added one parameter to the callback: TotalAmount. This will return the money you have when the callback OnPlayerMoneyChange is being called.
-Modified a variable in the OnPlayerUpdate callback, in the include. Unnecessarily usage of MAX_PLAYERS is not needed.
How-to
Copy the script of the pastebin url.
Open a new notepad file. Paste the script you copied at the pastebin url.
Go to your GTA San Andreas server files folder.
Save the notepad file as OPMC.inc at /pawno/include.
In your gamemode/filterscript/script:
Type this at your includes list, at the top of your script:
pawn Код:
#include <OPMC>
pawn Код:
public OnPlayerMoneyChange(playerid, amount, totalamount)
{
new string[100];
format(string, sizeof(string), "Your money has been changed with a value of $%i. Your total balance is: $%i", amount, totalamount);
SendClientMessage(playerid, -1, string);
return 1;
}
Pastebin Version: 2.0
Pastebin Version: 1.0
No mirrors allowed!
Known bugs
None so far.
Feel free to post bugs on this section, if you found any.
Credits
- Biesmen
- Wups - Idea for the ALS Hooking