OnPlayerDriveBy for 0.3d RC2 and above -
KoczkaHUN - 18.09.2011
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:
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.
Re: OnPlayerDriveBy for 0.3d R2 and above -
Kaperstone - 18.09.2011
nice!
thanks
Re: OnPlayerDriveBy for 0.3d R2 and above -
FireCat - 18.09.2011
Nice
Re: OnPlayerDriveBy for 0.3d R2 and above -
wups - 18.09.2011
Nice. Did you test it? I'm not sure if "&& weaponid == WEAPON_VEHICLE" works.
Re: OnPlayerDriveBy for 0.3d R2 and above -
Mass_Deboose - 18.09.2011
Thx. God job.
Re: OnPlayerDriveBy for 0.3d R2 and above -
Edvin - 18.09.2011
Nice include very usefull
Re: OnPlayerDriveBy for 0.3d R2 and above -
Jafet_Macario - 18.09.2011
Nice.
Re: OnPlayerDriveBy for 0.3d R2 and above -
Geso - 19.09.2011
It's for RC2 right? Not R2
Re: OnPlayerDriveBy for 0.3d R2 and above -
|_ⒾⓇⓄN_ⒹⓄG_| - 19.09.2011
nice
Re: OnPlayerDriveBy for 0.3d R2 and above -
[HiC]TheKiller - 19.09.2011
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;
}