Help, Speedbost
#1

Hello, i maked speedboost in my server , but when the player join race i want to disable it and disable flying car how to do that please help! +rep

This Code Fly and speedboost in Gamemode:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
 	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if (newkeys & KEY_FIRE && GetPlayerState(playerid) - 1)
		{
			new Float:x, Float:y, Float:z, Float:r;

		    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
			GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
			if((z > 0 && z < 0.3) || (z < 0 && z > -0.3) || z == 0)
			{
				GetVehicleZAngle(GetPlayerVehicleID(playerid), r);
				SetVehicleVelocity(GetPlayerVehicleID(playerid), x + (0.5 * floatsin(-r, degrees)), y + (0.5 * floatcos(-r, degrees)), z);
			}
			else
				SetVehicleVelocity(GetPlayerVehicleID(playerid), x * 1.6, y * 1.6, z * 1.6);
			return 1;
		}
		if (newkeys & KEY_SUBMISSION && GetPlayerState(playerid)-1)
		{
			new Float:T[3];
			new Float:dis = 0.2;
			GetVehicleVelocity(GetPlayerVehicleID(playerid), T[0], T[1], T[2]);
			SetVehicleVelocity(GetPlayerVehicleID(playerid), T[0], T[1], floatadd(T[2],dis));
			SetVehicleAngularVelocity(GetPlayerVehicleID(playerid), 0, 0, 0);
			RepairVehicle(GetPlayerVehicleID(playerid));
			SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.00);
		}
		if(newkeys == KEY_SUBMISSION )
		{
			new Float:a;
			GetVehicleZAngle(GetPlayerVehicleID(playerid),a);
			SetVehicleZAngle(GetPlayerVehicleID(playerid),a);
		}

	}
	return 1;
}
Im Using rRace System
Reply
#2

either implement that boost system in your race system , else if you are using file saving systems like dini , y_ini
set a variable in it like "InRace" and put a timer for player when he connects , in race system update the players file and set InRace to 1 and in that timer where you are updating players variables just put like

pawn Код:
InRace[playerid] = 1;
And then Check In OnPlayerKeyStateChange...
Try it
Reply
#3

Can you show us the script of the speedboost and the race script?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)