SA-MP Forums Archive
[Include] New SA-MP callbacks! - 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] New SA-MP callbacks! (/showthread.php?tid=490436)

Pages: 1 2 3 4 5 6 7 8 9


Re: New SA-MP callbacks! - LikeNPC - 27.01.2014

Very Nice!


Re: New SA-MP callbacks! - Ballu Miaa - 27.01.2014

Damn looks lovely Emmet! Another cool release from you. Loved the callbacks. It will more helpful for all the Roleplay servers. I will use them for sure!
pawn Код:
// Called when a player falls from a tall height.
forward OnPlayerFall(playerid, Float:height, Float:damage);

// Called when a player crashes their vehicle.
forward OnPlayerCrashVehicle(playerid, vehicleid);
Also i suggest something like this.

pawn Код:
// Called when a player crashes their vehicle.
forward OnPlayerCrashVehicle(playerid, vehicleid, Float:damage);
Where damage = damage done to the car in the crash.


Re: New SA-MP callbacks! - Emmet_ - 27.01.2014

Thanks guys.

Quote:
Originally Posted by ******
Посмотреть сообщение
Except no-one ever says "PRESSED(keys) && HOLDING(keys)", plus all the macros should be in an include anyway.
Good point, I haven't really noticed those macros until now. I'll do some further testing later on.

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Another great release EMMAAT. I'm expecting this include to have more cool features and I can assure that it would get updated with useful callbacks.

Btw, the pausing system's timer is being called every 600ms and detects if OPU is called or not. From my experience, OPU might get paused when a player is entering a vehicle, or is at dead state. It would be good if OPU is set to true under OnPlayerStateChange too. Sorry if I'm wrong, but I've experienced such things with 0.3x R1.
Perhaps I should add a time check to the pause detection. Thanks for reporting!

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Damn looks lovely Emmet! Another cool release from you. Loved the callbacks. It will more helpful for all the Roleplay servers. I will use them for sure!
pawn Код:
// Called when a player falls from a tall height.
forward OnPlayerFall(playerid, Float:height, Float:damage);

// Called when a player crashes their vehicle.
forward OnPlayerCrashVehicle(playerid, vehicleid);
Also i suggest something like this.

pawn Код:
// Called when a player crashes their vehicle.
forward OnPlayerCrashVehicle(playerid, vehicleid, Float:damage);
Where damage = damage done to the car in the crash.
Great suggestion! I'll add it right now.

Код:
Updates:
- Added "OnPlayerUseVending" - called when a player uses a vending machine.
- OnPlayerCrashVehicle now has a damage parameter ("Float:damage").
- Fixed the pause detector, it should be much more accurate now.



Re: New SA-MP callbacks! - Rube - 27.01.2014

Great release! nice one


Re: New SA-MP callbacks! - kristo - 27.01.2014

LOL, really bad time for the release. You should update the script to the new 0.3z RC4 natives. Bad luck but nice job though.


Re: New SA-MP callbacks! - cr33d - 27.01.2014

Great work i use some of this callback Especialy For vehicle crashing


Re: New SA-MP callbacks! - EmilLykke - 27.01.2014

This is some very nice shiet.


Re: New SA-MP callbacks! - kooltuO - 28.01.2014

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Thanks, everyone.

Код:
Updates:
- Added OnPlayerFPSChange(playerid, oldfps, newfps).
- Added a USE_OPTIMAL_MODE setting.
- Added GetPlayerFPS(playerid).
- Fixed a bug where OnPlayerCrashVehicle was sometimes called twice.
- Memory and performance improvements!
To use the new optimal mode setting, do this:

pawn Код:
#define USE_OPTIMAL_MODE
#include <callbacks>
Which uses a 600 ms timer instead of OnPlayerUpdate.
Those functions are the best. GetPlayerFPS should save me some time.


Re: New SA-MP callbacks! - cr33d - 28.01.2014

Can you just give me the idea or example for using of OnPlayerFPSChange(playerid, oldfps, newfps)
This is so good include that i have no more idea


Re: New SA-MP callbacks! - Emmet_ - 28.01.2014

pawn Код:
public OnPlayerFPSChange(playerid, oldfps, newfps)
{
    static
        str[24]
    ;
    format(str, 24, "~r~FPS:~w~ %d", newfps);
    PlayerTextDrawSetString(playerid, g_FPSTextdraw[playerid], str);
    return 1;
}
Taken from my gamemode.

Also:

pawn Код:
CMD:laggers(playerid, params[])
{
    static
        str[1024],
        name[MAX_PLAYER_NAME]
    ;
    foreach (new i : Player)
    {
        if (GetPlayerFPS(i) < 30)
        {
            GetPlayerName(i, name, sizeof(name));
            format(str, sizeof(str), "%s%s (%d FPS)\n", str, name, GetPlayerFPS(i));
        }
    }
    return ShowPlayerDialog(playerid, DIALOG_LAGGERS, DIALOG_STYLE_LIST, "List of Laggers", str, "Close", "");
}



Re: New SA-MP callbacks! - kN1GhT - 29.01.2014

Amazing man!


Re: New SA-MP callbacks! - cr33d - 29.01.2014

Thanks +rep for you


Re: New SA-MP callbacks! - Optimus_Sprite - 29.01.2014

YSI and Emmet_ callbacks

Код:
warning 235: public function lacks forward declaration (symbol "CB_OnPlayerUpdate")



Re: New SA-MP callbacks! - Luis- - 29.01.2014

Wow, I like the /laggers command, I think i'm going to add that into my gamemode.


Re: New SA-MP callbacks! - Emmet_ - 29.01.2014

Quote:
Originally Posted by Optimus_Sprite
Посмотреть сообщение
YSI and Emmet_ callbacks

Код:
warning 235: public function lacks forward declaration (symbol "CB_OnPlayerUpdate")
Fixed, thanks.

Quote:
Originally Posted by Luis-
Посмотреть сообщение
Wow, I like the /laggers command, I think i'm going to add that into my gamemode.
Feel free to! I'm planning on creating a textdraw menu for it, I'll release it shortly.


Re: New SA-MP callbacks! - Luis- - 29.01.2014

Ah, that sounds awesome actually, cannot wait to see it


Re: New SA-MP callbacks! - im - 29.01.2014

IsPlayerNearVending might not detect some vending machines. There were a few threads with positions for vending machines and some vending machines were missing (the ones inside 24/7 stores). I tested this like a year ago with data from other threads and all of them had some vending machine positions missing.

Support for y_timers would also be nice.


Re: New SA-MP callbacks! - xF4Life - 29.01.2014

These are nice, good job.


Re: New SA-MP callbacks! - Emmet_ - 31.01.2014

Thanks, everyone. The textdraw menu for lagging players is nearly complete, I just have to add a few touch ups!

Quote:
Originally Posted by im
Посмотреть сообщение
IsPlayerNearVending might not detect some vending machines. There were a few threads with positions for vending machines and some vending machines were missing (the ones inside 24/7 stores). I tested this like a year ago with data from other threads and all of them had some vending machine positions missing.

Support for y_timers would also be nice.
I agree, the vending machine coordinates array is missing a few machines. I've just traveled through interiors and around the world and typed /save at the machines.

I'll add y_timers support later on, thanks for the suggestion!


Re: New SA-MP callbacks! - PT - 01.02.2014

one idea:

pawn Код:
native GetServerIP();
add that.