how to make repair with 2?
#6

Quote:
Originally Posted by decondelite
Посмотреть сообщение
Kostas: that's not optimised at all AND it will NOT work correctly.
1) If you test that the player is a driver, then why checking if he's in a vehicle?
2) Use one if inside another if instead of using "&&"
3) newkays==KEY_SUBMISSION will work very bad

Here's something that works faster, that is easier to read and that works better:
Код:
#define KeyPressed(%0) (newkeys & %0) && !(oldkeys & %0)

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if (KeyPressed(KEY_SUBMISSION)) RepairVehicle(GetPlayerVehicleID(playerid));
	}
    return 1;
}
I'd just do
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
        if (newkeys & KEY_SUBMISSION) RepairVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
Reply


Messages In This Thread
how to make repair with 2? - by niels44 - 09.11.2011, 15:02
Re: how to make repair with 2? - by Kostas' - 09.11.2011, 15:06
Re: how to make repair with 2? - by niels44 - 09.11.2011, 15:27
Re: how to make repair with 2? - by Kostas' - 09.11.2011, 15:29
Re : how to make repair with 2? - by decondelite - 09.11.2011, 15:34
Re: Re : how to make repair with 2? - by FireCat - 09.11.2011, 15:38
Re: Re : how to make repair with 2? - by Kostas' - 09.11.2011, 15:47

Forum Jump:


Users browsing this thread: 1 Guest(s)