07.07.2011, 13:28
I want /flip but it should not be a command.When i press 2 , then it should be fliped.Can anyone give me code?
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:PX, Float:PY, Float:PZ, Float:PA;
GetPlayerPos(playerid, PX, PY, PZ);
GetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
SetVehiclePos(GetPlayerVehicleID(playerid), PX, PY, PZ+1);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SendClientMessage(playerid, -1,"Vehicle flip!!");
}
else
{
SendClientMessage(playerid, -1,"Error: you're not in Vehicle ");
}
}
return 1;
}
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SUBMISSION))
{
//flip things
return 1;
}
return 1;
}