[Include] OnPlayerDriveBy for 0.3d R2 and above
#1

KoczkaHUN's OnPlayerDriveBy 0.1
Description
This include introduces a new callback:
pawn Код:
public OnPlayerDriveBy(playerid, victimid, iskill)
This callback will be fired when a player hits an other player with a vehicle.

How is this possible?
This is possible with SAMP 0.3d RC2's new callback, called "OnPlayerTakeDamage".

Usage:
Download the include, and save it in pawno/includes folder with name kopdb.inc
In your FilterScript/GameMode, put it in the top:
pawn Код:
#include <kopdb>
You can test the include with a script like this:
pawn Код:
public OnPlayerDriveBy(playerid, victimid, iskill)
{
    new msg[128], name1[24], name2[24], iskillstr[24] = "but it was not a kill";
    GetPlayerName(playerid, name1, 24); GetPlayerName(victimid, name2, 24);
    if (iskill) iskillstr = "and it was a kill";
    format(msg, 128, "< !! DRIVE-BY !! > %s DriveBy-ed on %s, %s",
    name1, name2, iskillstr);
    return SendClientMessageToAll(-1, msg);
}
Notes:
- When a player kills an other player with DB, first it fires up callback with iskill = 0, after that with iskill = 1
- When a player stops on an other player with a vehicle (DB), callback will be spammed while the victim loses health. Keep this in mind.

Download:
Pastebin - OnPlayerDriveBy 0.1

Can I make a script made from this?
Please don't do that. I have plans for updating this in the future.
If you have an idea, feel free to post it here.
Reply
#2

nice!
thanks
Reply
#3

Nice
Reply
#4

Nice. Did you test it? I'm not sure if "&& weaponid == WEAPON_VEHICLE" works.
Reply
#5

Thx. God job.
Reply
#6

Nice include very usefull
Reply
#7

Nice.
Reply
#8

It's for RC2 right? Not R2
Reply
#9

nice
Reply
#10

This won't actually detect if the player is drivebying, it will detect if someone has parked on the top of another player / choppers them. You can fix this by doing


pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
        if (issuerid != INVALID_PLAYER_ID && (weaponid == 32 || weaponid == 28 || weaponid == 29) && KOPDB_hasOPDB && (GetPlayerState(issuerid) == PLAYER_STATE_PASSENGER || GetPlayerState(issuerid) == PLAYER_STATE_DRIVER))
                CallLocalFunction("OnPlayerDriveBy", "ddd", issuerid, playerid, 0);
 
        return (KOPDB_hasOPTD) ? KOPDB_CallOPTD() : 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)