Wie wird dieser Code aufgerufen?
Durch ein Dialog (list)
Der Befehl:
ocmd:fahrzeug(playerid,params[])
{
ErlaubnisAbfrage(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Rot,"Du sitzt in keinem Auto.");
if(GetPlayerState(playerid)!= PLAYER_STATE_DRIVER) return SendClientMessage(playerid,Rot,"Diesen Befehl darf nur der Fahrer nutzen.");
ShowPlayerDialog(playerid,DIALOG_FAHRZEUG_OPTION,DIALOG_STYLE_LIST,"Fahrzeug","Scheinwerfer\nAlarm\nMotorhaube\nKofferraum","Auswählen","Abbrechen");
return 1;
}
OnDialogResponse
if(dialogid == DIALOG_FAHRZEUG_OPTION)
{
if(response == 0)
{
ShowPlayerDialog(playerid,DIALOG_FAHRZEUG_OPTION,DIALOG_STYLE_LIST,"Fahrzeug","Scheinwerfer\nAlarm\nMotorhaube\nKofferraum","Auswählen","Abbrechen");
}
if(response == 1)
{
return 1;
}
if(listitem == 0)//Scheinwerfer
{
new vid=GetPlayerVehicleID(playerid);
if(Licht[vid]==true)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,0,alarm,doors,bonnet,boot,objective);
Licht[vid]=false;
}
else if(Licht[vid]==false)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,1,alarm,doors,bonnet,boot,objective);
Licht[vid]=true;
}
}
if(listitem == 1)
{
new vid=GetPlayerVehicleID(playerid);
if(Alarm[vid]==true)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,0,doors,bonnet,boot,objective);
Alarm[vid]=false;
}
else if(Alarm[vid]==false)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,1,doors,bonnet,boot,objective);
Alarm[vid]=true;
}
}
if(listitem == 2)
{
new vid=GetPlayerVehicleID(playerid);//
if(Motorhaube[vid]==true)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,false,boot,objective);
Motorhaube[vid]=false;
}
else if(Motorhaube[vid]==false)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,true,boot,objective);
Motorhaube[vid]=true;
}
}
if(listitem == 3)
{
new vid=GetPlayerVehicleID(playerid);//Kofferraum
if(Kofferraum[vid]==true)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,0,objective);
Kofferraum[vid]=false;
}
else if(Kofferraum[vid]==false)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,1,objective);
Kofferraum[vid]=true;
}
}
}
Zur Info: Die anderen gehen auch nicht