[Include] Callbackz (Beta)
#1

Callbackz





Introduction:
This include have some callbacks and functions that i think you can find useful. Some of them were posted as sugestions, other's are my own ideas.



Install:
Just copy the file to yoour "include" folder.



Important:If you will use this include on a Filterscript, you must add this before including the file:
pawn Код:
#define FILTERSCRIPT


Callbacks and functions of the include

Callbacks
Код:
OnPlayerPause(playerid)
OnPlayerAFK(playerid)
OnPlayerShotPlayer(playerid, targetid, Float:Heath, Float:Armour, weaponidt) (Headshot parameter removed)
OnPlayerWeaponChange(playerid, newweaponid, oldweaponid)
OnPlayerVirtualWorldChange(playerid, newworldid, oldworldid)
OnPlayerEnterWater(playerid)
OnPlayerExitWater(playerid)
OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour)
OnPlayerMoneyChange(playerid, newmoney, oldmoney)
OnPlayerUseMachine(playerid)
OnVehicleCreate(vehicleid)
OnVehicleDestroy(vehicleid)
OnPlayerUseVendingMachine(playerid)
OnPlayerPlayAnimation(playerid, Lib[], Name[])
OnPlayerScoreChange(playerid, newscore, oldscore)
Functions
Код:
SetPlayerAFK(playerid, bool:afk) 
IsPlayerAFK(playerid)
IsPlayerPaused(playerid)
IsPlayerInWater(playerid)
IsPlayerParachuting(playerid)
IsPlayerUsingMachine(playerid)
SetPlayerMoney(playerid, money)
CrashPlayer(playerid)
EnableDriveBy(bool:enable)
EnablePlayerDriveBy(playerid, bool:enable)
EnableInteriorDamage(bool:enable)
EnablePlayerInteriorDamage(playerid, bool:enable)
Reconnect(playerid)
ReconnectEx(playerid, time)
GetPlayerFPS(playerid)
GetVehiclePlate(vehicleid, Plate[], size)
GetVehicleColor(vehicleid, color1, color2)
GetVehicleInterior(vehicleid)
GetVehicleIDFromPlate(Plate[])
IsVehicleCreated(vehicleid)
EnableVendingMachines(bool:enable)
EnableVendingMachinesForPlayer(playerid, bool:enable)
EnableCapsLock(bool:enable)
EnableCapsLockForPlayer(playerid, bool:enable)
GivePlayerScore(playerid, score)
GetOnlinePlayers(bool:CountNPC)
AddForbidenNick(nick[]) (New!)
AddForbidenWord(word[]) (New!)
EnableTiresDamage(bool:Enable) (New!)
EnableTiresDamageForVehicle(vehicleid, bool:Enable) (New!)
GetVehicleType(model) (New!)
Bugs
No known bugs until now. If you find one, please let me know, so i can fix it.
Is very likely that when you compile a script that use this include, you get one (or two) warns like the following, but there's nothing to worry about.
pawn Код:
warning 200: symbol "@yH_VehicleDamageStatusUpdate2C" is truncated to 31 characters


Requirements:
YSI - (Direct download)
foreach(optional)



Download
Pastebin



Changelog
17/8/2011 (1є Beta release)
18/8/2011 (version 1.0)
Fixed some script bugs.
22/8/2011 (version 1.1)
Fixed some script bugs and added new callbacks & functions:
Код:
OnPlayerUseVendingMachine(playerid) (old OnPlayerUseMachine)
OnPlayerPlayAnimation(playerid, Lib[], Name[])
OnPlayerScoreChange(playerid, newscore, oldscore)

EnableVendingMachines(bool:enable)
EnableVendingMachinesForPlayer(playerid, bool:enable)
EnableCapsLock(bool:enable)
EnableCapsLockForPlayer(playerid, bool:enable)
GivePlayerScore(playerid, score)
GetOnlinePlayers(bool:CountNPC)
6/9/2011 (version 2.0)
New OnPlayerShotPlayer system. (thx to wups).
The code was optimized.
Added the posivility to remove callbacks & functions, so the amx takes up less space.
New functions added:
Код:
AddForbidenNick(nick[])
AddForbidenWord(word[])
EnableTiresDamage(bool:Enable)
EnableTiresDamageForVehicle(vehicleid, bool:Enable)
GetVehicleType(model)

Suggestions
You can suggest new callbacks/functions that you like this script to contain, and if i can, i'll add them on future versions.



Creditos
JernejL (GetPlayerFPS y Reconnect (methods), and encode_tires function)
Double-O-Seven (Cross Product Functions)
Nero_3D (AdjustVector y GetPlayerCameraWeaponVector Functions)
wups (OnPlayerShootPlayer)
****** (YSI)
The Chaoz (Scripting)
Reply
#2

FUC**** Useful thanks man i will use it on my gm
Reply
#3

Someone Need to Make the Funcion:
pawn Код:
public OnFemalePlayerConnect(playerid)
{
    Rape(playerid);
    return;
}
Im still working on it, got Problem with anims O.o Joke. Nice Dude
Reply
#4

Quote:
Originally Posted by 4ir-W4ys
Посмотреть сообщение
Someone Need to Make the Funcion:
pawn Код:
public OnFemalePlayerConnect(playerid)
{
    Rape(playerid);
    return;
}
Im still working on it, got Problem with anims O.o Joke. Nice Dude
u may can do that geting players skin, or in rp servers if the player say that is a female... just some anims. but i don't find that useful
Reply
#5

What does
pawn Код:
Reconnect(playerid)
ReconnectEx(playerid, time)
Do?
Reply
#6

Bans a player and unbans within a time.
Reply
#7

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
What does
pawn Код:
Reconnect(playerid)
ReconnectEx(playerid, time)
Do?
force a player to reconect.
Reply
#8

ABout the OnPlayerShotPlayer
the Health is the Health lost right ? same with armour?
And please check this topic :
https://sampforum.blast.hk/showthread.php?tid=278151
Reply
#9

Since it interferes with my gamemode somehow, I'm taking only the Reconnect function. Nice work though with the rest.

By the way, is that OnPlayerUseMachine to detect the usage of vending machines?
Reply
#10

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
force a player to reconect.
I don't get it though, so if you crash, it'll invite them back into the game. If so that'd be so damn useful and the whole include is!

Nice include, it's well done!
Reply
#11

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
u may can do that geting players skin, or in rp servers if the player say that is a female... just some anims. but i don't find that useful
There are No Female Players, There are Shemales Players O.o
Reply
#12

Quote:
Originally Posted by 4ir-W4ys
Посмотреть сообщение
There are No Female Players, There are Shemales Players O.o
sorry i'm from argentina, that's why my english is not good.

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
I don't get it though, so if you crash, it'll invite them back into the game. If so that'd be so damn useful and the whole include is!

Nice include, it's well done!
you force a player to reconect, that means that when you use this function on a player, the player will disconnect and then connect.

Quote:
Originally Posted by Machida
Посмотреть сообщение
ABout the OnPlayerShotPlayer
the Health is the Health lost right ? same with armour?
And please check this topic :
https://sampforum.blast.hk/showthread.php?tid=278151
if player is cheating, his health/armour won't change, so u can check if it there's no variation to know if a players is using or not any health/armour cheat.
btw OnPlayerHealthChange (and armour) work as kind of anticheat.

Quote:
Originally Posted by Diagram
Посмотреть сообщение
Since it interferes with my gamemode somehow, I'm taking only the Reconnect function. Nice work though with the rest.

By the way, is that OnPlayerUseMachine to detect the usage of vending machines?
how it interfere with ur gm, may i can edit the code to fix that.

and about OnPlayerUseMachine yes, it is called when a player use a vending machine
Reply
#13

nice thanks
can you make:
pawn Код:
SetFPS(playerid);
please?
Reply
#14

New version avaliable, fixed some bugs and added new functions & callbacks (see changelog)
Reply
#15

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
I don't get it though, so if you crash, it'll invite them back into the game. If so that'd be so damn useful and the whole include is!

Nice include, it's well done!


It uses the ban ip 'glitch'. Ban somebody's IP and he'll lose connection to the server. Unban his IP at OnPlayerDisconnect and he'll re-join.
Reply
#16

Errors:

PHP код:
\pawno\include\YSI\y_hooks.inc(717) : error 021symbol already defined"OnPlayerEnterCheckpoint"
C:\Documents and Settings\vlad\Desktop\SAMP\pawno\include\YSI\y_hooks.inc(729) : error 021symbol already defined"OnPlayerLeaveCheckpoint"
pawno\include\YSI\y_hooks.inc(918) : error 025: function heading differs from prototype
pawno
\include\Callbackz.inc(218) : error 025: function heading differs from prototype
pawno
\include\Callbackz.inc(480) : error 017undefined symbol "rondom"
pawno\include\Callbackz.inc(485) : error 017undefined symbol "Plate"
pawno\include\Callbackz.inc(494) : error 017undefined symbol "rondom"
pawno\include\Callbackz.inc(499) : error 017undefined symbol "Plate"
gamemodes\Beat-F.pwn(2440) : warning 219local variable "pHealth" shadows a variable at a preceding level
gamemodes
\lvdm.pwn(2440) : warning 219local variable "pArmour" shadows a variable at a preceding level
gamemodes
\lvdm.pwn(2442) : error 035argument type mismatch (argument 2)
C:\Documents and Settings\vlad\Desktop\SAMP\gamemodes\Beat-F.pwn(2443) : error 035argument type mismatch (argument 2)
gamemodes\lvdm.pwn(2452) : warning 213tag mismatch
gamemodes
\lvdm.pwn(2452) : warning 213tag mismatch
gamemodes
\lvdm.pwn(2440) : warning 203symbol is never used"pArmour"
gamemodes\lvdm.pwn(2440) : warning 203symbol is never used"pHealth"
gamemodes\lvdm.pwn(6953) : error 021symbol already defined"crossp"
gamemodes\lvdm.pwn(6962) : error 021symbol already defined"GetDistanceFromPointToLine"
gamemodes\lvdm.pwn(9056) : warning 203symbol is never used"S@@_OnPlayerInteriorChange"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
12 Errors

Reply
#17

you should update your YSI version.
Reply
#18

using ban player for reconnect IS VERY BAD, let's say I'm on my school network.. playing with 20 friends GTA, now the admin wants to reconnect me and within the time it's reconnecting me, another friend wants to join... what happens? all players got disconnected and one player sees we're banned...
Happy playing lol!
and if in meantime the server shuts down for a reason then maybe the player will stay banned...

so in short: very dangerous reconnect function.
Reply
#19

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
using ban player for reconnect IS VERY BAD, let's say I'm on my school network.. playing with 20 friends GTA, now the admin wants to reconnect me and within the time it's reconnecting me, another friend wants to join... what happens? all players got disconnected and one player sees we're banned...
Happy playing lol!
and if in meantime the server shuts down for a reason then maybe the player will stay banned...

so in short: very dangerous reconnect function.
if you have an other method please tell me and i'll implement it, but it's the only way i know (thx to JernejL)
Reply
#20

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
you should update your YSI version.
More error:
PHP код:
pawno\include\YSI\y_utils.inc(392) : error 079inconsistent return types (array & non-array) 
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)