Spike strip Help
#1

Hello all ,

Код:
	if (strcmp(cmd,"/createstrip",true) == 0)
	{
	    if(IsACop(playerid))
		{
			if(OnDuty[playerid] != 1)
			{
			    new Float:X,Float:Y,Float:Z,Float:A;
		        GetPlayerPos(playerid, X, Y, Z);
		        GetPlayerFacingAngle(playerid,A);
		        CreateStrip(X,Y,Z,A);
		        GetPlayerName(playerid, sendername, sizeof(sendername));
		        format(string, sizeof(string), "HQ: Officer %s has successfully deployed a spikestrip.", sendername);
		        SendTeamMessage(1, TEAM_BLUE_COLOR, string);
		        SendTeamMessage(99, TEAM_BLUE_COLOR, string);
		        
			}
		}
	    return 1;
	}
also

Код:
stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
{
    for(new i = 0; i < sizeof(SpikeInfo); i++)
  	{
  	    if(SpikeInfo[i][sCreated] == 0)
  	    {
            SpikeInfo[i][sCreated]=1;
            SpikeInfo[i][sX]=x;
            SpikeInfo[i][sY]=y;
            SpikeInfo[i][sZ]=z-0.7;
            SpikeInfo[i][sObject] = CreateDynamicObject(2899, x, y, z-0.9, 0, 0, Angle-90);
	        return 1;
  	    }
  	}
  	return 0;
}
It works and everything , But when a vehicle drives over it , the TIRES don't blow out , any help ?
Reply
#2

you have no function call to update the damage to the vehicles tires.

Код:
stock PopPlayerTires(playerid)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	new panels, doors, lights, tires;
	GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
	UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 15);
}
strongly suggest checking to ensure a player is in a vehicle before function call...

On an After Thought, you dont even have anything detecting if the player is in a vehicle, or if the vehicle is touching the object.. Someone released a SpikeStrip system a while back.. heres the Source: http://pastebin.com/W5d6WH1F

That options uses Pickups, theres another option for a very small area check ... but i would suggest pickups as you don't need a timer or ticker.
Reply
#3

Where would I put the PopPlayerTires function at , I added in the stock now what
Reply
#4

You would need to run a loop to check if a player is in the distance of any of the spike strip objects, unless their is a more efficient way...
Reply
#5

lol, sorry i edited my reply, again, i dont suggest area check, its a waste of a timer, when a pickup is auto called on touch!
Reply
#6

Код:
C:\Documents and Settings\Owner\Desktop\SA-MP Server\gamemodes\RGv58.pwn(40332) : error 017: undefined symbol "GetVehicleDamageStatus"
C:\Documents and Settings\Owner\Desktop\SA-MP Server\gamemodes\RGv58.pwn(40334) : error 017: undefined symbol "UpdateVehicleDamageStatus"
Reply
#7

Quote:
Originally Posted by RealWorldGTA
Посмотреть сообщение
lol, sorry i edited my reply, again, i dont suggest area check, its a waste of a timer, when a pickup is auto called on touch!
Yes, but he's using objects currently :P, but it is better to use pickups though, its more efficient, instead of running a loop every second...
Reply
#8

Shawn, ( Update your compiler libraries from the server files download. )

Pot, ( Yes he is, but an object has no interaction with a vehicle unles its solid and a player is jsut going to run into it...

The Source ( not my source ) from my post, creates the object ( hes already doing ), and 'pickups' ... any player is driving, and touches pickup, it sets the tire bits to 15, thus they are 'Popped' ... one COULD use an an area check based on temp coords of the object, the downfall is, a timer is needed in some format, in a loop...

If a timer can be avoided, one SHOULD avoid it hence the reason for the pickup, as its auto called when ANYONE touches it.

Save a Resource here, can allow more resources in places he may better serve their needs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)