12.05.2015, 06:06
(
Last edited by Gammix; 14/06/2015 at 03:31 AM.
)
Players Library
Not any advance library; Just for free guys!
This library is pretty simple and straight forward but will come in great use if you see the capabilities of this. There are 4 branches of this libraries namely:
Advantages
Functions
Callbacks
Notes
GITHUB Page
Pastebin - playerfuncs.inc
Pastebin - playercalls.inc
Pastebin - playerstate.inc
Pastebin - playerstats.inc
Changelog
R3 - 13 May, 2015
Not any advance library; Just for free guys!
This library is pretty simple and straight forward but will come in great use if you see the capabilities of this. There are 4 branches of this libraries namely:
- playerfuncs.inc
- playercalls.inc
- playerstates.inc
- playerstats.inc
Advantages
- Faster outputing
- Wide range of callbacks
- Wide range of functions
- Player walking style settings
- Player update blocking (return 0 in callbaks)
- Short but effective code
- Standalone branches
- All in one version also available!
- Anti-Fake kill system with callback: OnPlayerFakeKill
- Time updater is quiet useful. You can use just one callback to update all player stuff and one callback for server as well.
Functions
Quote:
//playerfuncs.inc native GivePlayerScore(playerid, score); native SetPlayerMoney(playerid, money); native RemovePlayerWeapoon(playerid, weaponid); native SetPlayerFacingPoint(playerid, Float:x, Float:y); native IsPlayerFacingPoint(playerid, Float:x, Float:y, Float:range = 10.0); native SetPlayerFacingPlayer(playerid, targetid); native IsPlayerFacingPlayer(playerid, targetid, Float:range = 10.0); native IsPlayerBehindPlayer(playerid, targetid, Float:range = 10.0); native GetPlayerWeaponAmmo(playerid, weaponid); native SetPlayerWeaponAmmo(playerid, weaponid, ammo); native SetPlayerWalkingStyle(playerid, style); native GetPlayerWalkingStyle(playerid); native GetPlayerSkillLevel(playerid, skill); //playercalls.inc native IsPlayerPaused(playerid); native GetPlayerPausedTime(playerid); //playerstates.inc native IsPlayerSpawned(playerid); native IsPlayerSpectating(playerid); native IsPlayerDriver(playerid); native IsPlayerInClassSelection(playerid); native IsPlayerDead(playerid); //playerstats.inc native GetPlayerKills(playerid); native GetPlayerDeaths(playerid); native GetPlayerSpree(playerid); native GetPlayerConnectedTime(playerid, &hours, &minutes, &seconds); native GetPlayerHeadshots(playerid); native GetPlayerWeaponShots(playerid); native GetPlayerWeaponHits(playerid); |
Quote:
//playerfuncs.inc public public OnPlayerWalk(playerid, style) //playercalls.inc public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz); public OnPlayerFacingAngleChange(playerid, Float:newangle, Float:oldangle); public OnPlayerWeaponChange(playerid, newweapon, oldweapon); public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth); public OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour); public OnPlayerVirtualWorldChange(playerid, newworld, oldworld); public OnPlayerSkinChange(playerid, newskin, oldskin); public OnPlayerPingChange(playerid, newping, oldping); public OnPlayerAmmoChange(playerid, weaponid, newammo, oldammo); public OnPlayerKillPlayer(playerid, killerid, weaponid); public OnPlayerPause(playerid); public OnPlayerUnpause(playerid, time); public OnPlayerFakeKill(playerid, count); public OnPlayerMoneyChange(playerid, newmoney, oldmoney); public OnPlayerScoreChange(playerid, newscore, oldscore); //playerstates.inc //no callbacks //playerstats.inc public OnPlayerHeadshot(playerid, issuerid, weaponid) |
- Setting walking style is as simple as setting fighting style:
pawn Code:public OnPlayerSpawn(playerid)
{
SetplayerWalkingStyle(playerid, WALKING_STYLE_DRUNK);
return 1;
} - You can run the branches separately or you may use all in one version: playerlib.inc
- The defined walking styles list can be found in playerfuncs.inc or here:
pawn Code://walking styles
#define WALKING_STYLE_DEFAULT 0
#define WALKING_STYLE_CIVILIAN 1
#define WALKING_STYLE_GANGSTA 2
#define WALKING_STYLE_GANGSTA_2 3
#define WALKING_STYLE_OLD 4
#define WALKING_STYLE_FAT_OLD 5
#define WALKING_STYLE_FAT 6
#define WALKING_STYLE_LADY 7
#define WALKING_STYLE_LADY_2 8
#define WALKING_STYLE_WHORE 9
#define WALKING_STYLE_WHORE_2 10
#define WALKING_STYLE_DRUNK 11
#define WALKING_STYLE_BLIND 12
#define WALKING_STYLE_ARMED 13 - The callbacks will block the updating of players if you return 0 in them. It will not process when you haven't defined a specific callback.
Here is all the callback list:
pawn Code:public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz)
{
return 1;
}
public OnPlayerFacingAngleChange(playerid, Float:newangle, Float:oldangle)
{
return 1;
}
public OnPlayerWeaponChange(playerid, newweapon, oldweapon)
{
return 1;
}
public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
{
return 1;
}
public OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour)
{
return 1;
}
public OnPlayerVirtualWorldChange(playerid, newworld, oldworld)
{
return 1;
}
public OnPlayerSkinChange(playerid, newskin, oldskin)
{
return 1;
}
public OnPlayerPingChange(playerid, newping, oldping)
{
return 1;
}
public OnPlayerAmmoChange(playerid, weaponid, newammo, oldammo)
{
return 1;
}
public OnPlayerKillPlayer(playerid, killerid, weaponid)
{
return 1;
}
public OnPlayerPause(playerid)
{
return 1;
}
public OnPlayerUnpause(playerid, time)
{
return 1;
}
public OnPlayerFakeKill(playerid, count)
{
return 1;
}
public OnPlayerMoneyChange(playerid, newmoney, oldmoney)
{
return 1;
}
public OnPlayerScoreChange(playerid, newscore, oldscore)
{
return 1;
}
public OnPlayerWalk(playerid, style)
{
return 1;
}
public OnPlayerHeadshot(playerid, issuerid, weaponid)
{
return 1;
} - You can block player activity or updating by returning 0 in every callback. For example you have god mode:
pawn Code:public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
{
if(GodMode[playerid])//if the player has GOD mode ON
{
SetPlayerHealth(playerid, 10000.0);
}
return 1;
} - If you are making a headshot system, do all the stuff under OnPlayerHeadshot, the script already has done the coding for you(not much though).
- GetPlayerPausedTime only shows a valid value when the player is paused or AFK. Its value is reset to 0 when the player unpauses his/her game. You can get the paused time from the callback OnPlayerUnpause(playerid, time). The param time is the paused time.
- No ammo changing technique for snipers (NO RELOAD):
pawn Code:public OnPlayerAmmoChange(playerid, weaponid, newammo, oldammo)
{
if(weaponid == 34) return 0;
return 1;
} - You can disable anti fake kill by commenting
pawn Code:#define ANTI_FAKE_KILL //comment this if you don't want anti fake kill system
GITHUB Page
Pastebin - playerfuncs.inc
Pastebin - playercalls.inc
Pastebin - playerstate.inc
Pastebin - playerstats.inc
Changelog
R3 - 13 May, 2015
- Fixed some bugs in playerfuncs.inc
- Fixed some bugs in playercalls.inc
- Added a better method of hooking (funcidx) (thanks Lordzy)
- Added 2 new callbacks:
pawn Code:public OnPlayerMoneyChange(playerid, newmoney, oldmoney);
public OnPlayerScoreChange(playerid, newscore, oldscore); - Renewed OnPlayerAmmoChange; now detects ammo change completely from internal script or from player!
- Added Anti-Fake kill system
- Initial release