ramping bugged
#1

hi everybody
i have a bug
the bug is in the angle when i type CTRL then the object will create but its angle is towards right .Its only happens with the road ids for e.g 17639 changes its angle but ramp doesnt, could someone help me please and yes i want that when player press CTRL again and again so his previous object gets remove and the new object will create



Код:
#include <a_samp>
#define red 0xFF0000AA

new Pressedkey[MAX_PLAYERS] = {false, ...};
new jumped[MAX_PLAYERS] = {-1, ...};
new ramped[MAX_PLAYERS];
forward Keys();
forward DeleteRamp(playerid);
forward Float:GetRampDistance(playerid);
forward Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);

public OnFilterScriptInit()
{
	SetTimer("Keys", 100, 1);
	return 1;
}

public Keys()
{
	new keys, jump, updown, playerid;
	new Float:x, Float:y, Float:z, Float:angle;
	for (playerid = 0; playerid < MAX_PLAYERS; playerid++) {
	  if (IsPlayerConnected(playerid)) {
			GetPlayerKeys(playerid, keys, jump, updown);
			if(ramped[playerid] == 1)
			{
			
			}
			else if (keys & KEY_FIRE && IsPlayerInAnyVehicle(playerid)) {{
					  GetPlayerPos(playerid, x, y, z);
					  angle = GetPosInFrontOfPlayer(playerid, x, y, GetRampDistance(playerid));
					  jumped[playerid] = CreateObject(17639, x, y, z - 0.5, 0.0, 0.0, angle);
					  ramped[playerid] = 1;
					  SetTimerEx("DeleteRamp", 1000, 0, "d", playerid);
				  }
			  }
			} else Pressedkey[playerid] = false;
		}
}

public DeleteRamp(playerid)
{
	if (jumped[playerid] != -1) {
	  DestroyObject(jumped[playerid]);
	  jumped[playerid] = -1;
	  ramped[playerid]=0;
	}
}

public OnFilterScriptExit()
{
	for (new i=0; i<MAX_PLAYERS; i++)
	{
		if (jumped[i] != -1) DestroyObject(jumped[i]);
	}
}

Float:GetRampDistance(playerid)
{
	new ping = GetPlayerPing(playerid), Float:dist;
	dist = floatpower(ping, 0.25);
	dist = dist*4.0;
	dist = dist+5.0;
	return dist;
}

Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	else GetPlayerFacingAngle(playerid, a);
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
	return a;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	for (new i=0; i<MAX_PLAYERS; i++)
	{
		if (jumped[i] != -1) DestroyObject(jumped[i]);
	}
}
Reply


Messages In This Thread
ramping bugged - by _Sami_ - 02.12.2009, 09:08
Re: ramping bugged - by RyDeR` - 02.12.2009, 12:06
Re: ramping bugged - by _Sami_ - 02.12.2009, 20:13

Forum Jump:


Users browsing this thread: 1 Guest(s)