02.06.2015, 12:46
You can't detect the key G.
But another key, for example H:
Greekz
But another key, for example H:
PHP код:
//Under OnPlayerKeyStateChange
if(newkeys & KEY_CTRL_BACK) Enter_Hydra(playerid);
//Outside any other callback
stock Enter_Hydra(playerid)
{
new veh = GetHydraInRange(playerid);
if(!veh) return 0;
switch(IsHydraSeatFree(veh))
{
case true: PutPlayerInVehicle(playerid,veh,1);
}
return 1;
}
stock GetHydraInRange(playerid)
{
for(new i,l=GetVehiclePoolSize()+1,Float:p[3]; i<l; i++)
{
if(GetVehicleModel(i) != 520) continue;
GetVehiclePos(i,p[0],p[1],p[2]);
if(IsPlayerInRangeOfPoint(playerid,6.5,p[0],p[1],p[2])) return i;
}
return 0;
}
stock IsHydraSeatFree(veh)
{
for(new i,l=GetPlayerPoolSize()+1; i<l; i++)
{
if(GetPlayerVehicleID(i) != veh) continue;
if(GetPlayerVehicleSeat(i) == 1) return 0;
}
return 1;
}