Working Spike Strips` - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Working Spike Strips` (
/showthread.php?tid=548421)
Working Spike Strips` -
Jonesy96 - 29.11.2014
Hi all, I'm trying to get spike strips to successfully pop the appropriate tire/tires. I.e., if only the front left wheel goes over the spike, I only want that tire to be popped. However, my code doesn't pop any tires at al when I drive over spikes. Can anyone help me please?
Thanks
Code:
Код:
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
for(new i = 0; i < sizeof(activeroadblocks); i++){
if(activeroadblocks[i] == 2982 || activeroadblocks[i] == 2989){
new Float:x, Float:y, Float:z;
GetObjectPos(activeroadblocks[i], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)){
new panels, doors, lights, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(carid, panels, doors, lights, 1);
}
}
}
}
return 1;
}
Re: Working Spike Strips` -
Jonesy96 - 29.11.2014
Bump. Still having the issue. New code:
Код:
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
for(new i = 0; i < sizeof(activeroadblocks); i++){
if(activeroadblocks[i][1] == 2982 || activeroadblocks[i][1] == 2989){
new Float:x, Float:y, Float:z;
GetObjectPos(activeroadblocks[i][0], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)){
new panels, doors, lights, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(carid, panels, doors, lights, 1);
}
}
}
}
return 1;
}
Still doing absolutely nothing
Re: Working Spike Strips` -
Abagail - 29.11.2014
Use a print statement to see how far the code goes.
Example:
Use different prints for every few if statements / lines of code.