SA-MP Forums Archive
[Include] Players Library (callbacks, functions, and addons) - 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] Players Library (callbacks, functions, and addons) (/showthread.php?tid=573961)



Players Library (callbacks, functions, and addons) - Gammix - 12.05.2015

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:Each include/branch is standalone, so you may grab and use the one you require. The code is clean and user friendly. You have many features and callbacks and functions to use.

Advantages List View
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);

Callbacks
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)

Notes Downloads
GITHUB Page

Pastebin - playerfuncs.inc
Pastebin - playercalls.inc
Pastebin - playerstate.inc
Pastebin - playerstats.inc

Changelog
R3 - 13 May, 2015 R2 - 12 May, 2015 R1 - 12 May, 2015


Re: Players Library (callbacks, functions, and addons) - Emmet_ - 12.05.2015

pawn Code:
public OnPlayerKillPlayer(playerid, killerid, weaponid)
{
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerDeath

lol


Re: Players Library (callbacks, functions, and addons) - Gammix - 12.05.2015

Quote:
Originally Posted by Emmet_
View Post
pawn Code:
public OnPlayerKillPlayer(playerid, killerid, weaponid)
{
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerDeath

lol
Yeah, that a lol But just for those who dont make these checks:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    if( killerid != INVALID_PLAYER_ID &&
        playerid != INVALID_PLAYER_ID &&
        ! IsPlayerNPC(killerid) &&
        ! IsPlayerNPC(playerid))
    {
        reason = GetPlayerWeapon(killerid);
        if(! IsValidWeapon(reason)) reason = 0;

        CallLocalFunction("OnPlayerKillPlayer", "iii", playerid, killerid, reason);
    }
        return 1;
}



Re: Players Library (callbacks, functions, and addons) - $$inSane - 12.05.2015

Pretty good. I will use those callbacks


Re: Players Library (callbacks, functions, and addons) - Emmet_ - 12.05.2015

Ah, okay. Nice btw. I have a suggestion, you can add a "fakekill" parameter to OnPlayerKillPlayer which will make it more useful.


Re: Players Library (callbacks, functions, and addons) - Gammix - 12.05.2015

Quote:
Originally Posted by Emmet_
View Post
Ah, okay. Nice btw. I have a suggestion, you can add a "fakekill" parameter to OnPlayerKillPlayer which will make it more useful.
Sure brother.


Re: Players Library (callbacks, functions, and addons) - Alex Magaсa - 12.05.2015

This are same like other SA-MP includes. ._. nothing changed at all.!


Re: Players Library (callbacks, functions, and addons) - Gammix - 12.05.2015

Quote:
Originally Posted by Alex Magaсa
View Post
This are same like other SA-MP includes. ._. nothing changed at all.!
Link of those other relevant includes?

Update:
R2 - 12 May, 2015


Re: Players Library (callbacks, functions, and addons) - Yashas - 12.05.2015

Are the functions inline?

The script will be much faster without using this include.


Make these macros:
GetPlayerPausedTime(playerid)
IsPlayerPaused(playerid)
GivePlayerScore(playerid, score) - Set Player Score already has an internal IsPlayerConnected
SetPlayerMoney(playerid, money)
.
.
.

Update your ALS Hook Method

If a bullet was shot then the ammo will obviously change unless its a hacker.I don't see any use of OnPlayerAmmoChange.

IsPlayerBehindPlayer(playerid, targetid, Float:range = 10.0)
This won't work.

GetPlayerConnectedTime(playerid, &hours, &minutes, &seconds)
There is an equivalent function https://sampwiki.blast.hk/wiki/NetStats_GetConnectedTime

Anyway there are some useful functions in the include.
Good Work!!


Re: Players Library (callbacks, functions, and addons) - Crayder - 12.05.2015

Quote:
Originally Posted by Yashas
View Post
Are the functions inline?
Why would they be? They are in a library.

Quote:
Originally Posted by Yashas
View Post
The script will be much faster without using this include.
False.


Quote:
Originally Posted by Yashas
View Post
Make these macros:
GetPlayerPausedTime(playerid)
IsPlayerPaused(playerid)
GivePlayerScore(playerid, score) - Set Player Score already has an internal IsPlayerConnected
SetPlayerMoney(playerid, money)
Two of those are already inside, one is already native, and the other is VERY simple.

Quote:
Originally Posted by Yashas
View Post
Update your ALS Hook Method
Why? It's fine.

Quote:
Originally Posted by Yashas
View Post
If a bullet was shot then the ammo will obviously change unless its a hacker.I don't see any use of OnPlayerAmmoChange.
There are other uses than anti-hack, this is NOT an anti-hack library.

Quote:
Originally Posted by Yashas
View Post
IsPlayerBehindPlayer(playerid, targetid, Float:range = 10.0)
This won't work.
Yes it will. Have you thought about testing?

Quote:
Originally Posted by Yashas
View Post
GetPlayerConnectedTime(playerid, &hours, &minutes, &seconds)
There is an equivalent function https://sampwiki.blast.hk/wiki/NetStats_GetConnectedTime
No, he made it easier to get the intervals (there are more newbs that need things like that).

Quote:
Originally Posted by Yashas
View Post
Anyway there are some useful functions in the include.
Good Work!!
Finally, something nice!

Rep++.