SA-MP Forums Archive
[Include] [INC] Useful Callbacks [V.1.1] - 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] [INC] Useful Callbacks [V.1.1] (/showthread.php?tid=24671)



[INC] Useful Callbacks [V.1.1] - Rafelder_GRF - 01.02.2008

UC - Useful Callbacks
I don't want to talk too much :P
I made some callbacks with which you can check some things based on the "normal" samp functions.

Callbacks:
OnPlayerGetHealth(playerid, health)
This callback checks if one player gets health.
OnPlayerLoseHealth(playerid, health)
This callback checks if one player loses health.
OnPlayerGetArmour(playerid, armour)
This callback checks if one player gets armour.
OnPlayerLoseArmour(playerid, armour)
This callback checks if one player loses armour.
OnPlayerGetMoney(playerid, money)
This callback checks if one player gets money.
OnPlayerLoseMoney(playerid, money)
This callback checks if one player loses money.
OnPlayerGetScore(playerid, score)
This callback checks if one player gets score.
OnPlayerLoseScore(playerid, score)
This callback checks if one player loses score.
OnPlayerGetWantedLevel(playerid, wantedlevel)
This callback checks if one player gets wantedlevel.
OnPlayerLoseWantedLevelplayerid, wantedlevel)
This callback checks if one player loses wantedlevel.
OnPlayerChangeToVehicle(playerid, vehicleid, driver)
This callback checks if one player changes his state. It checks the driver and passenger state (driver / !driver).
OnPlayerChangeToFoot(playerid)
This callback checks if one player changes his state. It checks the onfoot state.
OnPlayerSwitchWeapon(playerid, oldweapon, newweapon)
This callback checks if one player switchs his weapons. You can check the new and the old weapon.
OnPlayerPressKey(playerid, key)
This callback checks if one player presses a key.
OnPlayerPressMoveKey(playerid, key)
This callback checks if one player presses a move key (up, down, left, right).

How to install:
Add #include <UC> at the top of your script
Add AddCallbacks(); in OnGameModeInIt()
Add RemoveCallbackStats(playerid); in OnPlayerConnect or OnPlayerDisconnect

If you get this error: error 004: function "OnPlayerGetHealth" is not implemented you forgot this callback into your script.

Rapidshare
Pastebin


Re: [INC] Useful Callbacks - Kowalski - 01.02.2008

Hey nice job, this will be usefull for all servers.

And a small typo:
Quote:

OnPlayerChangeToVehicle(playerid, vehicleid, driver)

Kowalski


Re: [INC] Useful Callbacks - mini_tomo_2 - 01.02.2008

Looks good. I'll check back in a few days.


Re: [INC] Useful Callbacks - Grove - 01.02.2008

Quite useful for detecting cheats.


Re: [INC] Useful Callbacks - R@f - 01.02.2008

nice I will use it

R@f


Re: [INC] Useful Callbacks - $$$PiMp - 02.02.2008

Hey this is nice for removing the text draw speedo when a player doesn't manually exit a vehicle, but i cant download from rapidshit so can you please add it to pastebin.COM

Thank You,
Allan(MoNeYPiMp)


Re: [INC] Useful Callbacks - Rafelder_GRF - 02.02.2008

Quote:
Originally Posted by [SAS
MoNeYPiMp ]
Hey this is nice for removing the text draw speedo when a player doesn't manually exit a vehicle, but i cant download from rapidshit so can you please add it to pastebin.COM

Thank You,
Allan(MoNeYPiMp)
Sure


Re: [INC] Useful Callbacks - $$$PiMp - 02.02.2008

Thanks


Re: [INC] Useful Callbacks [V.1.1] - Numhaken - 05.02.2008

Freaking awsome callbacks, I really like them, very usfull for alot of things including detection of cheaters! Want a mirror ?


Re: [INC] Useful Callbacks [V.1.1] - Luk0r - 05.02.2008

Nice, is this done using timer(s)?