Working Spike Strips`
#1

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;
}
Reply
#2

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
Reply
#3

Use a print statement to see how far the code goes.

Example:
pawn Код:
print("test abc");
Use different prints for every few if statements / lines of code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)