22.09.2010, 21:47
(
Последний раз редактировалось gamer931215; 23.09.2010 в 06:14.
)
About
Hello guys, after reading Las Venturas CNR's topic (https://sampforum.blast.hk/showthread.php?tid=178405)
i decided to make an bugfix for this.
The bug
Basicly when you jacked someone's vehicle, stepped in as passenger, and you keep pressing the space key the victim would die!
The fix
What is basicly does is when you pressed/holding/releasing the sprint key when youre stepping in an vehicle, and another player is inside it will teleport you to your position to stop you from jacking. This means it isnt possible to jack anymore if you use the space key!
The script:
I know im not very good in optimising code, if you have a better idea/tips/optimalisations, feel free to post !
Credits
Las Venturas CNR for inspiring me
ksoriano100 for testing
me for scripting
Hello guys, after reading Las Venturas CNR's topic (https://sampforum.blast.hk/showthread.php?tid=178405)
i decided to make an bugfix for this.
The bug
Basicly when you jacked someone's vehicle, stepped in as passenger, and you keep pressing the space key the victim would die!
The fix
What is basicly does is when you pressed/holding/releasing the sprint key when youre stepping in an vehicle, and another player is inside it will teleport you to your position to stop you from jacking. This means it isnt possible to jack anymore if you use the space key!
The script:
pawn Код:
#include <a_samp>
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new IsPlayerSteppingInVehicle[MAX_PLAYERS] = -1;
public OnPlayerStateChange(playerid,newstate,oldstate)
{
IsPlayerSteppingInVehicle[playerid] = -1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
IsPlayerSteppingInVehicle[playerid] = vehicleid;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING(KEY_SPRINT) || PRESSED(KEY_SPRINT) || RELEASED(KEY_SPRINT))
{
if (IsPlayerSteppingInVehicle[playerid] > -1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerVehicleID(i) == IsPlayerSteppingInVehicle[playerid] && i != playerid)
{
new Float:x,Float:y,Float:z,pName[28],string[128];
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z);
GameTextForPlayer(playerid,"~r~Please do NOT abuse the \r\n~w~Jack bug",5000,4);
IsPlayerSteppingInVehicle[playerid] = -1;
GetPlayerName(playerid,pName,28);
format(string,sizeof string,"%s(%i) has tried to abuse the jack bug!",pName,playerid);
print(string);
}
}
}
}
return 1;
}
Credits
Las Venturas CNR for inspiring me
ksoriano100 for testing
me for scripting