spikes are not working
#1

Hey!

I need some help with this, I made a command that spawn those spikes for cops but it's not popping the tires.
Reply
#2

Please post the command code and we'll be glad to help you!
Reply
#3

The objects don't pop tyres, I once made one of these scripts.
You can get the position of the spikes (GetObjectPos) and then if the player is within a certain distance of the spikes (IsPlayerInRangeOfPoint) you can set his tires to burst with UpdateVehicleDamageStatus
Reply
#4

pawn Код:
CMD:Spikes(playerid,params[])
{
 #pragma unused params
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1212,x,y,z,0.0,0.0,96.0);
return1;
}
Reply
#5

What part of
Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
The objects don't pop tires
did you not understand?
Reply
#6

It was a while ago when i made this, but try this:
pawn Код:
new Float:SpikeX, Float:SpikeY, Float:SpikeZ; //This has to be used in the command as well as the OnPlayerUpdate callback, so create it outside of the cmd.
CMD:Spikes(playerid,params[])
{
 #pragma unused params
GetPlayerPos(playerid, SpikeX, SpikeY, SpikeZ);
CreateObject(1212,SpikeX, SpikeY, SpikeZ,0.0,0.0,96.0);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 2.00, SpikeX, SpikeY, SpikeZ) && IsPlayerInAnyVehicle(playerid)) { //If the player is near the spikes, and he is in a car...
new panels, doors, lights, tires;
GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, 15); //15 will burst all tyres, change the number if you only want some tyres to pop.
}
return 1;
}
Compiles with no errors, but I haven't tested it
Hope I helped
Reply
#7

Check if the vehicle is on the spikes, then:

https://sampwiki.blast.hk/wiki/UpdateVehicleDamageStatus
Reply
#8

@AstonDag Thanks dude, it worked, I'd +rep you but I can't since I must have 50 post to give reputation :l
But I got a problem.
The ScreenShot says all


Hope you guys can help me
Reply
#9

I think you mean this: Just check if the player is not in a vehicle. Only then spawn the spike.. Or, is that not what you mean?
Reply
#10

Wouter.. .can you see the spikes? They're in the air.

I'm not sure which of x,y,z is the height, but try every single one of them with -4 or -3 etc.
Example : ..., x-4, ... or ....,z-3,.... till it only drops down
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)