09.03.2014, 17:54
As seen in the video:
ww.youtube.com/watch?v=z75GCjRS9PI
I gotta use the command twice to open the hood, and twice to turn on lights and twice to open trunk.
Any idea why?
ww.youtube.com/watch?v=z75GCjRS9PI
I gotta use the command twice to open the hood, and twice to turn on lights and twice to open trunk.
Any idea why?
pawn Код:
CMD:car(playerid, params[])
{
new Option[32];
new vid = GetPlayerVehicleID(playerid);
if(sscanf(params, "s[32]", Option)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /car [Engine/Lights/Hood/Trunk/Speedo]");
new eengine,llights,aalarm,ddoors,bbonnet,bboot,oobjective;
GetVehicleParamsEx(vid,eengine,llights,aalarm,ddoors,bbonnet,bboot,oobjective);
{
if(strcmp(Option, "engine", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && pData[playerid][TurnKey] == 0)
{
if(eengine == 0)
{
new TextString[128];
format(TextString, sizeof TextString,"* %s turns the vehicle key, attempting to start the vehicle.",RemoveUnderLine(GetName(playerid)));
ProxDetector(30, playerid, TextString, COLOR_RPPURPLE);
pData[playerid][TurnKey] = 1;
pvCar[playerid][EngineTimer] = SetTimerEx("EngineOn", 3000, false, "i", playerid);
}
else
{
SetVehicleParamsEx(vid,0,llights,aalarm,ddoors,bbonnet,bboot,oobjective);
new TextString[128];
format(TextString, sizeof TextString,"* %s turns the vehicle key, Turning the vehicle off.",RemoveUnderLine(GetName(playerid)));
ProxDetector(30, playerid, TextString, COLOR_RPPURPLE);
}
}
}
if(strcmp(Option, "lights", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(llights == 0)
{
SetVehicleParamsEx(vid,eengine,1,aalarm,ddoors,bbonnet,bboot,oobjective);
}
else
{
SetVehicleParamsEx(vid,eengine,0,aalarm,ddoors,bbonnet,bboot,oobjective);
}
}
}
if(strcmp(Option, "trunk", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(bboot == 0)
{
SetVehicleParamsEx(vid,eengine,llights,aalarm,ddoors,bbonnet,1,oobjective);
}
else
{
SetVehicleParamsEx(vid,eengine,llights,aalarm,ddoors,bbonnet,0,oobjective);
}
}
}
if(strcmp(Option, "hood", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(bbonnet == 0)
{
SetVehicleParamsEx(vid,eengine,llights,aalarm,ddoors,1,bboot,oobjective);
}
else
{
SetVehicleParamsEx(vid,eengine,llights,aalarm,ddoors,0,bboot,oobjective);
}
}
}
}
return 1;
}