How to set this right.
#1

Hey so i have a problem with this...

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new veh = GetPlayerVehicleID(playerid); 
    if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid)) 
    {
        AddVehicleComponent(veh,1010); 
        return 1;
    }
    else
	{
        RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        return 1;
	}
	
    if(newkeys & KEY_CROUCH) 
	{
        if(JumpSize[playerid] == 0) return 1;
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
		new Float: x, Float: y, Float: z;
		GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z + JumpSize[playerid]); //The same here.
        return 1;
	}
	return 1;
}
The top, the nitrous works but the jump doesnt..
Reply
#2

Don't bump you idoit...
You must wait 24 hours.
anyways will edit when i find the bug(if i find it)
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new veh = GetPlayerVehicleID(playerid); 
    if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid)) 
    {
        AddVehicleComponent(veh,1010); 
        return 1;
    }
    else
	{
        RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        return 1;
	}
	
    if(newkeys & KEY_CROUCH) 
	{
        if(JumpSize[playerid] == 5) return 1;
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
		new Float: x, Float: y, Float: z;
		GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z + JumpSize[playerid]); //The same here.
        return 1;
	}
	return 1;
}
Try that!!!
Reply
#3

Quote:
Originally Posted by Aveger
Посмотреть сообщение
Don't bump you idoit...
You must wait 24 hours.
anyways will edit when i find the bug(if i find it)
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new veh = GetPlayerVehicleID(playerid); 
    if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid)) 
    {
        AddVehicleComponent(veh,1010); 
        return 1;
    }
    else
	{
        RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        return 1;
	}
	
    if(newkeys & KEY_CROUCH) 
	{
        if(JumpSize[playerid] == 5) return 1;
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
		new Float: x, Float: y, Float: z;
		GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z + JumpSize[playerid]); //The same here.
        return 1;
	}
	return 1;
}
Try that!!!
Tried but i get 1 warning... The (352)

Код:
C:\Users\ilmar\Desktop\Click Clack FUN Server\gamemodes\EEF1.pwn(245) : warning 217: loose indentation
C:\Users\ilmar\Desktop\Click Clack FUN Server\gamemodes\EEF1.pwn(352) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)