02.10.2014, 18:25
[Include] New SA-MP callbacks!
02.10.2014, 18:26
03.10.2014, 00:13
I decided to go with "OnPlayerBurning" and added "status" parameter (1 = burning, 0 = stopped burning). IMO, it's better to have one callback for the same action rather than having 2. I'll add it, if you want.
10.12.2014, 07:10
There will be no lag. I ran this on a server with 50+ players flawlessly. Let's take this snippet from callbacks.inc:
This section of code will only be called if "OnPlayerBurning" is defined in the other script, e.g:
pawn Код:
if (g_bCallbacks & CB_OnPlayerBurning)
{
if (g_cbPlayers[playerid][e_cbFlags] & e_cbBurning)
{
if ((GetTickCount() - g_cbPlayers[playerid][e_cbLastBurn]) >= 1500)
{
g_cbPlayers[playerid][e_cbFlags] &= ~e_cbBurning;
CallLocalFunction("OnPlayerBurning", "dd", playerid, 0);
}
}
}
pawn Код:
#include <a_samp>
#include <callbacks>
public OnPlayerBurning(playerid, status)
{
// ...
}
31.12.2014, 12:58
I just noticed now that OnPlayerTakeDamage on this include isn't properly hooked. I know that Emmet_ is inactive now but since this include is being used by members, I'm posting the fixed OnPlayerTakeDamage part of it here. I've also posted a pull-request regarding it on it's GitHub repository.
Thanks to Kyance for posting an issue about this which led me to find out.
pawn Код:
//Replace the old one with this
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if (g_bCallbacks & CB_OnPlayerBurning && weaponid == 37)
{
if (!(g_cbPlayers[playerid][e_cbFlags] & e_cbBurning))
{
g_cbPlayers[playerid][e_cbFlags] |= e_cbBurning;
CallLocalFunction("OnPlayerBurning", "dd", playerid, 1);
}
g_cbPlayers[playerid][e_cbLastBurn] = GetTickCount();
}
#if defined CB_OnPlayerTakeDamage
return CB_OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart);
#else
return 1;
#endif
}
10.02.2015, 00:46
It's been more than 4 months since I've updated this..
I am planning on updating this in the next few days. I've discovered some new detection methods and found some bugs. I don't want to abandon this project because of my laziness lol. Anyway.. stay tuned for more news, and I thank everyone for using it!
I am planning on updating this in the next few days. I've discovered some new detection methods and found some bugs. I don't want to abandon this project because of my laziness lol. Anyway.. stay tuned for more news, and I thank everyone for using it!
10.02.2015, 02:24
Awesome, thanks Emmet!
13.03.2015, 09:18
Another update:
And 2 new callbacks:
Functions for the new callbacks:
Action types for OnPlayerActionChange:
Example is in the first post.
Thanks for using this everybody! This update is proof that I haven't abandoned this project at all. I will update this project as long as I'm still playing SA:MP.
Код:
- Rewrote a lot of the code. - Added better code to detect if a player is falling. - Renamed a few callbacks: OnPlayerCarJack -> OnPlayerJackVehicle OnPlayerWeaponEmpty -> OnPlayerEmptyWeapon OnPlayerDisableCursor -> OnPlayerHideCursor OnPlayerAnimationFinish -> OnPlayerAnimationPlay - Removed OnPlayerTakePicture. This caused some issues and didn't work properly. - Removed the "Float:height" parameter from OnPlayerFall due to inaccuracy.
pawn Код:
public OnPlayerActionChange(playerid, oldaction, newaction)
{
return 1;
}
public OnPlayerRamPlayer(playerid, driverid, vehicleid, Float:damage)
{
return 1;
}
pawn Код:
stock GetPlayerAction(playerid);
stock IsPlayerSkydiving(playerid);
stock IsPlayerSwimming(playerid);
pawn Код:
#define PLAYER_ACTION_NONE (0)
#define PLAYER_ACTION_SHOOTING (1)
#define PLAYER_ACTION_SWIMMING (2)
#define PLAYER_ACTION_SKYDIVING (3)
#define PLAYER_ACTION_JUMPING (4)
Thanks for using this everybody! This update is proof that I haven't abandoned this project at all. I will update this project as long as I'm still playing SA:MP.
13.03.2015, 09:43
I might use this in the future.
+rep
+rep
13.03.2015, 23:16
Quote:
Another update:
Код:
- Rewrote a lot of the code. - Added better code to detect if a player is falling. - Renamed a few callbacks: OnPlayerCarJack -> OnPlayerJackVehicle OnPlayerWeaponEmpty -> OnPlayerEmptyWeapon OnPlayerDisableCursor -> OnPlayerHideCursor OnPlayerAnimationFinish -> OnPlayerAnimationPlay - Removed OnPlayerTakePicture. This caused some issues and didn't work properly. - Removed the "Float:height" parameter from OnPlayerFall due to inaccuracy. pawn Код:
pawn Код:
pawn Код:
Thanks for using this everybody! This update is proof that I haven't abandoned this project at all. I will update this project as long as I'm still playing SA:MP. |
16.03.2015, 10:31
Added two more callbacks:
And a function for one of the two new callbacks:
Now there are 23 callbacks in total!
I did some benchmarks while running this include on a public server with only 2 callbacks being used. There was barely any lag. So you shouldn't worry about that.
pawn Код:
// Called when a player uses a camera to take a picture.
public OnPlayerUseCamera(playerid);
// Called when a player sprays at a vehicle with a spraycan.
public OnPlayerSprayAtVehicle(playerid, vehicleid);
pawn Код:
stock IsPlayerSprayingVehicle(playerid, vehicleid);
I did some benchmarks while running this include on a public server with only 2 callbacks being used. There was barely any lag. So you shouldn't worry about that.
21.03.2015, 16:43
Why does it give me this errors?
C:\Users\Trayansh\Desktop\SAMP\pawno\include\callb acks.inc(501) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Trayansh\Desktop\SAMP\pawno\include\callb acks.inc(823) : warning 219: local variable "health" shadows a variable at a preceding level
i checked line 501 and 823,those lines are not related to health
C:\Users\Trayansh\Desktop\SAMP\pawno\include\callb acks.inc(501) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Trayansh\Desktop\SAMP\pawno\include\callb acks.inc(823) : warning 219: local variable "health" shadows a variable at a preceding level
i checked line 501 and 823,those lines are not related to health
21.03.2015, 16:48
You probably have a global variable called "health" in your gamemode. Rename or remove it
21.04.2015, 05:34
(
Последний раз редактировалось ToiletDuck; 22.04.2015 в 03:45.
)
@EDIT: i figure out
14.12.2015, 15:04
Quote:
when I compile my gamemode, I get this error.
C:\Users\Jacob\Desktop\Pawn\pawno\include\ncbs.inc (812) : error 025: function heading differs from prototype That is this section of code: Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) |
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
16.12.2015, 10:20
OnPlayerFall does not seem to be working.
24.01.2016, 23:09
Really useful!
20.02.2016, 09:09
Fix OnPlayerFall.
20.02.2016, 09:16
Good work brother +rep
21.02.2016, 12:06
« Next Oldest | Next Newest »
Users browsing this thread: 25 Guest(s)