20.08.2011, 17:48
(
Последний раз редактировалось gamer931215; 20.08.2011 в 20:26.
)
OnPlayerJackVehicle V1.1
About:I've seen a few includes from Wups and i was suprised how usefull those functions were, so i decided to make one myself for people who are annoyed by vehicle jackers.
This include will detect when players are jacking or getting jacked.
Callbacks:.
pawn Код:
public OnPlayerJackVehicle(playerid,victimid,vehicleid,bool:ninjajack)
{
/*playerid= the player whos jacking, victimid = the player who is getting jacked
vehicleid = the vehicle getting jacked and ninjajack is when a player is ninjajacking (bug abuse)
ninjajack will be true when positive (player was ninja jacking), and false when negative (no ninja jack).*/
return 1;
}
public OnPlayerGotJacked(playerid,jackerid,vehicleid)
{
/*Playerid = the playerid getting jacked, jackerid = the player whos jacking
and vehicleid is the vehicle getting jacked.*/
return 1;
}
Код:
When you are jacking too fast between echother then OnPlayerGotJacked() will may not be called! My advice is just using OnPlayerJackVehicle() !
pawn Код:
/*
This example script is written by Gamer931215
This scripts is showing the usage of OPJV and will show
how to make it impossible to jack other players's vehicles!
*/
#include <a_samp>
#include <OPJV>
public OnPlayerJackVehicle(playerid,victimid,vehicleid,bool:ninjajack)
{
if(ninjajack == true)
{
SendClientMessage(playerid,0xffffffff,"Ninja-jacking is NOT allowed!");
Kick(playerid);
} else {
TogglePlayerControllable(playerid,0);
GameTextForPlayer(playerid,"~w~Jacking is ~r~NOT ~w~allowed!",5000,6);
SetTimerEx("UnfreezePlayer",5000,false,"i",playerid);
}
return 1;
}
public OnPlayerGotJacked(playerid,jackerid,vehicleid)
{
PutPlayerInVehicle(playerid,vehicleid,0); //putting player back in vehicle (just in case)
return 1;
}
forward UnfreezePlayer(playerid);
public UnfreezePlayer(playerid)
{
TogglePlayerControllable(playerid,1);
}
http://pastebin.com/pgjDSd8i