SA-MP Forums Archive
[Include] Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) (/showthread.php?tid=499178)



Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Crayder - 06.03.2014

pawn Код:
/*  |=========================================|  *\
    |                                         |
    |             Crayder's Cash              |
    |    This script was made for all those   |
    |  Server owner's who hate Money-Hackers! |
    |                                         |
    |   Thanks to me, SAMP team, and Y-Less   |
    |                                         |
\*  |=========================================|  */

Crayder's Cash!
This script was made for all those server owners who are new to scripting and don't like Money-Hackers!
I made this script on my free time some while ago, I have before then and after seen requests for server siding money... So I thought about configuring this mini script and releasing it.

Extra Information
You may enjoy the default "money" system, but I don't like resetting and giving cash when I need to! Sure, it does get the job done, but I felt the need to extend this matter, so I added a few function along with this script, just to help you guys out. (Below are the functions of the script.)

pawn Код:
/*  ==========================================  *\
    native SetPlayerCash(playerid, amount);         -Sets their cash to the specified amount.
    native TakePlayerCash(playerid, amount);        -Takes the specified amount of cash from them.
    native GivePlayerCash(playerid, amount);        -Gives the specified amount of cash to them.
    native ResetPlayerCash(playerid, amount);       -Resets their cash.
    native GetPlayerCash(playerid, amount);         -Returns the amount of cash.
\*  ==========================================  */
All of these added features are flawless and VERY simple, and pretty self explaining, so we will move on to the installation...

Installation
1. Download the file provided below in the downloads section, and place it in your include folder (SERVER/PATH/pawno/includes/)
2. Include it in your gamemode! (Add this line to the top of your script.)
Quote:

#include <c_cash>

If you want you can EASILY use foreach for this script! All you need to do is include foreach BEFORE including c_cash, like so:
Quote:

#include <foreach>
#include <c_cash>

3. Set the update timer! (Add this line to the "public OnGameModeInit()" function/)
Quote:

SetTimer("Cash_Update", 25, true);

If you want, you can change the interval (25) to whatever, but at 25 milliseconds I find it to be flawless.
4. Search and Replace ALL of the GetPlayerMoney, GivePlayerMoney and ResetPlayerMoney functions with GivePlayerCash and ResetPlayerCash. Using Pawno this is simple, just press Ctrl+H, in the "Search for:" field type GivePlayerMoney, and in the "Replace with:" field type GivePlayerCash. Do the same thing for ResetPlayerMoney and GetPlayerMoney.
5. If everything is done correctly, you should be done! You can now go try to hack your own server, or wait for hackers to come through. But REMEMBER: you can no longer use GivePlayerMoney or ResetPlayerMoney, GetPlayerMoney will still work actually, but GetPlayerCash is more efficient because it returns the players server sided variable! If you try using ResetPlayerMoney or GivePlayerMoney, the system will just change whatever you did back to what it is in the servers variables.

Downloads
Click here to download the include! (4Shared)
Click here to view the include! (PasteBin)

Any problems?
Comment or PM me any thing you have trouble with, I'll do my best to help you!

My request!
If this can be translated i'm sure other people will be delighted to use it when they can read it themselves, so if anyone can translate, go ahead and you will be +REPPED by me, just PM me the link to your translated version so I can post it here!


Re: Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Ada32 - 06.03.2014



edit: woops ,wrong type of hook https://sampforum.blast.hk/showthread.php?tid=85907


Re: Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Crayder - 07.03.2014

I know I chose not to use hooks! I figured I could just have the users replace the functions, and I wouldn't use a hook for OnGameModeInit just to set a timer...

EDIT: But yea, maybe I'll add a hooked version to this post, but only hooking the functions, the users will still need to implement the timer (Why hook OGMI just for a timer am I right? Or what do you suggest...)...


Re: Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Pottus - 07.03.2014

Always always always, did I say always? Hook your callbacks in a include there is no excuse not to do this!

This is not an excuse in my books (Why hook OGMI just for a timer am I right? Or what do you suggest...)


Re: Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - Crayder - 07.03.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Always always always, did I say always? Hook your callbacks in a include there is no excuse not to do this!

This is not an excuse in my books (Why hook OGMI just for a timer am I right? Or what do you suggest...)
We'll, tomorrow I will fix it...


Re: Crayder's Cash! Basic Server Sided Money! (Installation Tutorial!) - ProKillerpa - 07.03.2014

Include good!

I'll be conducting tests on it to get a more simplified result, it seems a good include, congratulations!