SA-MP Forums Archive
spikes are not working - 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: spikes are not working (/showthread.php?tid=405126)



spikes are not working - mailu - 05.01.2013

Hey!

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


Re: spikes are not working - arakuta - 05.01.2013

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


Re: spikes are not working - AstonDA-G - 05.01.2013

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


Re: spikes are not working - mailu - 05.01.2013

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;
}



Re: spikes are not working - Vince - 05.01.2013

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


Re: spikes are not working - AstonDA-G - 05.01.2013

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


Re: spikes are not working - ThePhenix - 05.01.2013

Check if the vehicle is on the spikes, then:

https://sampwiki.blast.hk/wiki/UpdateVehicleDamageStatus


Re: spikes are not working - mailu - 05.01.2013

@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


Re: spikes are not working - wouter0100 - 06.01.2013

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?


Re: spikes are not working - hydravink - 06.01.2013

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