07.06.2015, 23:16
(
Last edited by n0minal; 22/09/2015 at 07:53 PM.
)
Intro
I've been developing this include since yesterday, searching for bugs to fix and things to improve, and now I think that its finally done. This include is simple, it adds some useful callbacks to your gamemode by updating and doing simple comparisons to some vars, and if they aren't the same, the custom callback will be called with the needed parameters. Its quite simple, I just did this for my own gamemode and project and decided to release it here. Also, it uses ALS 4 - Hook Method 7 to deal with TogglePlayerControllable.Features
Here are the callbacks which you can use on your gamemode if you use this include:Code:
forward OnPlayerSkinChange(playerid, newskin, oldskin); forward OnPlayerNameChange(playerid, newname[], oldname[]); forward OnPlayerMoneyChange(playerid, newmoney, oldmoney); forward OnPlayerWantedLevelChange(playerid, newlevel, oldlevel); forward OnPlayerScoreChange(playerid, newscore, oldscore); forward OnPlayerWeaponSlotChange(playerid, slotid, new_weapon, oldweapon); forward OnPlayerAmmoChange(playerid, weaponid, newammo, oldammo); forward OnPlayerCurrentWeaponChange(playerid, new_weapon, oldweapon); forward OnPlayerVehicleChange(playerid, new_vehicle, oldvehicle); forward OnPlayerVehicleSeatChange(playerid, newseat, oldseat); forward OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth); forward OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour);[new] forward OnPlayerVirtualWorldChange(playerid, new_world, oldworld); forward OnPlayerPingChange(playerid, newping, oldping); forward OnPlayerFPSChange(playerid, newfps, oldfps); forward OnPlayerDrunkLevelChange(playerid, newlevel, oldlevel); forward OnPlayerFreezeStateChange(playerid, newstate, oldstate); forward OnPlayerTeamChange(playerid, newteam, oldteam); forward OnPlayerGenderChange(playerid, newgender, oldgender); [new] forward OnPlayerAimStateChange(playerid, weaponid, mode); [new]
Code:
//genders #define SKIN_GENDER_NONE 0 #define SKIN_GENDER_FEMALE 1 #define SKIN_GENDER_MALE 2 //aim states #define AIM_MODE_RELEASE 0 #define AIM_MODE_HOLD 1
How to use this
To use the include, you just need to include it on the top of your gamemode/filterscript:Example:
Quote:
#include <a_samp> #include <ibranch> |
Downloads and Links
GitHubBugs
I didn't found any for a while, if you find a bug, please contact me by PM or reply on this topic and I will fix it as far as possible.Check Also:
iCMD 8.0 Beta - Fastest CMD Processor! (English Topic Soon)
ipsTeam Official Server Development!
Changelog:
Quote:
[08/06] -Added hook for OnPlayerConnect -Fixed some switch issues -Added gender callback [11/06] -Added OnPlayerArmourChange -XoR operators changed to "!=" for better optimization [25/06] -Added aim callback -Added hook for OnPlayerKeyStateChange [27/06] -All the call methods, forwards and update branchs has now verifications for scripting needs (defined callbacks), it means that update is now so much lighter than before and the include now is faster and consume less RAM (the variables are also created only if the scripter needs it). -Added foreach and global timer -Removed per-playered timers -Update rate now is 80 by default -Many other improvements [22/09] -Hooked onplayerdisconnect -Player data is now cleared after player disconnects (to avoid desynced fake updates) |
Aim State Change support (pink msg = started aiming | orange msg = stopped aiming)
[ame]http://www.youtube.com/watch?v=mLBw3LNlGz8[/ame]
Credits:
-ipsLeon, ipsNan and ipsBruno;
-****** for knowledgements and ALS Hook Methods;
-Kalcor for creating SA-MP.
-Pottus and SickAttack for gender suggestion.
-Gammix for regarding me some stuff.
-Yashas and Adejair_Junior for suggesting script optimizations and #if defined to make the plugin be lighter.