Hey Leute,
ich möchte, wenn ich die Taste "M" drücke, der Befehl /motor ausgeführt wird...
hier der Befehl:
ocmd:motor(playerid,params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
SCM(playerid,RED,"Du musst der Fahrer sein!");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
for(new i=0;i<MAX_VEHICLES;i++)
{
if(FahrzeugInfo[i][fz_ID] == vehicleid)
{
switch(FahrzeugInfo[i][fz_Typ])
{
case 0:
{
if(pInfo[playerid][pFraktion] == FahrzeugInfo[i][fz_Besitzer])
{
if(FahrzeugInfo[i][fz_Motor] == 0)
{
if(FahrzeugInfo[i][fz_Tank] >= 1)
{
new str[200];
SetVehicleEngineOn(vehicleid);
format(str,sizeof(str),"%s schaltet den Motor an.",SpielerName(playerid));
MeMessage(playerid,str);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
else
{
SCM(playerid,gelb,"Der Tank ist leer!");
return 1;
}
}
else
{
SetVehicleEngineOff(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
}
else
{
SCM(playerid,COLOR_FADE3,"Du hast keine Schlüssel!");
return 1;
}
}
case 1:
{
if(playerid == FahrzeugInfo[i][fz_Besitzer])
{
if(FahrzeugInfo[i][fz_Motor] == 0)
{
if(FahrzeugInfo[i][fz_Tank] >= 1)
{
SetVehicleEngineOn(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
else
{
SCM(playerid,gelb,"Der Tank ist leer!");
return 1;
}
}
else
{
SetVehicleEngineOff(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
}
else
{
SCM(playerid,COLOR_FADE3,"Du hast keine Schlüssel!");
return 1;
}
}
case 7:
{
if(pInfo[playerid][pJob] == FahrzeugInfo[i][fz_Besitzer])
{
if(FahrzeugInfo[i][fz_Motor] == 0)
{
SetVehicleEngineOn(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
else
{
SetVehicleEngineOff(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
}
}
default:
{
if(FahrzeugInfo[i][fz_Motor] == 0)
{
SetVehicleEngineOn(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
else
{
SetVehicleEngineOff(vehicleid);
TextDrawHideForPlayer(playerid,Tacho_Info_Motor);
TextDrawHideForPlayer(playerid,Tacho_Info_Tueren);
TextDrawHideForPlayer(playerid,Tacho_Info_Licht);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAn);
TextDrawHideForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAn);
TextDrawHideForPlayer(playerid,Tacho_Info_LichtAus);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenAuf);
TextDrawHideForPlayer(playerid,Tacho_Info_TuerenZu);
TextDrawShowForPlayer(playerid,Tacho_Info_Motor);
TextDrawShowForPlayer(playerid,Tacho_Info_MotorAus);
TextDrawShowForPlayer(playerid,Tacho_Info_Box);
KillTimer(autotimer[playerid]);
autotimer[playerid]=SetTimerEx("drawtimer",2000,0,"i",playerid);
return 1;
}
}
}
}
}
}
return 1;
}
Derzeit habe ich es so gemacht:
if(newkeys == (KEY_NO))
{
if(IsPlayerInAnyVehicle(playerid))
{
SCM(playerid,COLOR_YELLOW,"Motor wird gezündet...");
return ocmd_motor(playerid,"");
}
return 1;
}
Der Befehl wird jedoch nicht ausgeführt
Wisst ihr was ich falsch mache? :o