08.11.2012, 14:53
Ta funcional, eu mesmo testei no meu servidor ..
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new mot, lu, alar, por, cap, porma, ob;
{
GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys == 4) && (IsPlayerInAnyVehicle(playerid)))
{
OnPlayerCommandText(playerid, "/motor");
return 1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if(carro != INVALID_VEHICLE_ID)
{
if(motor[playerid] == 0)
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
motor[playerid] = 1;
}
else if(motor[playerid] == 1)
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
}
}
}