23.11.2018, 19:39
Why when i press TAB it's saying "You have to be in a car!" ?
I maded it so i when you press 2 to fix your car. but when i press TAB it says "You have to be in a car" Of course in car when i press TAB it doesn't happen anything, only when i press 2 everything works, the only problem is why when i press TAB it's saying "You have to be in a car!".
Can someone tell me how to fix it, and why is happening this?
Here's the code:
I maded it so i when you press 2 to fix your car. but when i press TAB it says "You have to be in a car" Of course in car when i press TAB it doesn't happen anything, only when i press 2 everything works, the only problem is why when i press TAB it's saying "You have to be in a car!".
Can someone tell me how to fix it, and why is happening this?
Here's the code:
Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define IsPlayerNotInVehicle(%0) (!IsPlayerInAnyVehicle(%0))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SUBMISSION))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid, vehicleid))
{
SetVehicleHealth(vehicleid,1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
SendClientMessage(playerid,-1,"Car fixed!");
}
}
if(PRESSED(KEY_ACTION))
{
if(IsPlayerNotInVehicle(playerid))
{
SendClientMessage(playerid,-1,"You have to be in a car!");
}
}
return 1;
}

