29.07.2014, 07:15
Thank you now i can unrent my vehicle, but what should i add to my unrentcar command so if engine is on it turns it off.
My unrentcar cmd
and my engine command
I tried to get it work, but it's too hard for me.
My unrentcar cmd
pawn Код:
CMD:unrentcar(playerid, params[])
{
for(new i=0; i<5; i++)
{
if(GetPlayerState(playerid) == 2 && IsPlayerInVehicle(playerid, rentCAR[i]))
{
rentingVehicle[playerid] = false;
TogglePlayerControllable(playerid,1);
}
}
return 1;
}
pawn Код:
CMD:engine(playerid,params[])
{
new string[124];
new id = GetVehicleID(GetPlayerVehicleID(playerid));
new vehicleid = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleAccess(playerid, id) < 1)
return SendClientMessage(playerid, COLOR_RED, "* You don't have the keys for this vehicle!");
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == 2)
{
if(engine != 1)
{
SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the engine on.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(engine != 0)
{
SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the engine off.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
return 1;
}