Benötige Hilfe (Motorsystem, Errors)

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo, ich bekomme zu diesen Skriptzeilen:


    else if(motor[vehicleid] == false)
    {
    motor[vehicleid] = true;
    SetTimerEx("MotorStarten",7000,0,"i",playerid);
    SetPlayerChatBubble(playerid, string, GRUEN, 30.0, 2000);
    }
    else if(motor[vehicleid] == true)
    {
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    motor[vehicleid] = false;
    }

    Folgende Errorcodes:

    C:\Users\Marcel\Desktop\Selfmade Script\gamemodes\gege.pwn(4844) : error 029: invalid expression, assumed zero
    C:\Users\Marcel\Desktop\Selfmade Script\gamemodes\gege.pwn(4844) : warning 215: expression has no effect
    C:\Users\Marcel\Desktop\Selfmade Script\gamemodes\gege.pwn(4844) : error 001: expected token: ";", but found "if"
    C:\Users\Marcel\Desktop\Selfmade Script\gamemodes\gege.pwn(4844) : error 028: invalid subscript (not an array or too many subscripts): "motor"
    C:\Users\Marcel\Desktop\Selfmade Script\gamemodes\gege.pwn(4844) : fatal error 107: too many error messages on one line


    Meine Frage: Wieso bekomme ich diese Errorcodes?

  • Schreibe es mal so:
    if(motor[vehicleid] == false)
    {
    motor[vehicleid] = true;
    SetTimerEx("MotorStarten",7000,0,"i",playerid);
    SetPlayerChatBubble(playerid, string, GRUEN, 30.0, 2000);
    }
    else
    {
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    motor[vehicleid] = false;
    }


    Motor muss so deklariert sein:
    new bool:motor[MAX_VEHICLES];

  • ocmd:vc(playerid,params[])
    {
    new sendername[MAX_PLAYER_NAME];
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,GRAU,"Du bist nicht eingeloggt!");
    new vehicleid = GetPlayerVehicleID(playerid),cmd[25],string[128];
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,GRAU,"Du sitzt in keinem Fahrzeug.");
    if(GetPlayerVehicleSeat(playerid) != 0)return SendClientMessage(playerid,GRAU,"Du bist nicht der Fahrer des Fahrzeugs.");
    if(sscanf(params,"s[25]",cmd)) return SendClientMessage(playerid, GRAU,"Befehl: /vc[motor,licht]");
    if(strcmp(cmd,"Motor",true) == 0)
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    GetVehicleParamsEx(vehicleid,engine,light,alarm,doors,bonnet,boot,objective);
    TextDrawShowForPlayer(playerid, CIVBOX);
    TextDrawShowForPlayer(playerid, text6);
    TextDrawShowForPlayer(playerid, text7);
    SetTimerEx("HideBox",8000,0,"i",playerid);
    if(motor[vehicleid] == false)
    {
    motor[vehicleid] = true;
    format(string, sizeof(string), "* %s versucht den Motor seines Fahrzeugs einzuschalten...",sendername);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~W~Motor ~g~angeschaltet", 2000, 5);
    SetTimerEx("MotorStarten",7000,0,"i",playerid);
    SetPlayerChatBubble(playerid, string, GRUEN, 30.0, 2000);
    }
    else
    {
    GetVehicleParamsEx(vehicleid,engine,light,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,light,alarm,doors,bonnet,boot,objective);
    motor[vehicleid] = false;
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~W~Motor ~r~ausgeschaltet", 2000, 6);
    format(string, sizeof(string), "%s schaltet den Motor seines Fahrzeugs aus...",sendername);
    SetPlayerChatBubble(playerid, string, WEISS, 30.0, 2000);
    }
    return 1;
    }
    if(strcmp(cmd,"Licht",true) == 0)
    {
    GetVehicleParamsEx(vehicleid,engine,light,alarm,doors,bonnet,boot,objective);
    if(IsAFahrrad(vehicleid))
    {
    SendClientMessage(playerid,GRAU,"Das Fahrzeug hat keine Scheinwerfer.");
    return 1;
    }
    if(lichteran[vehicleid] == false)
    {
    GameTextForPlayer(playerid,"~w~Licht~g~ angeschaltet",2000,6);
    SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    lichteran[vehicleid] = true;
    }
    else
    {
    GameTextForPlayer(playerid,"~w~Licht ~r~ausgeschaltet",2000,6);
    SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    lichteran[vehicleid] = false;
    }
    return 1;
    }
    new coordsstring1[50];
    new insgesamtstring[2000];
    format(coordsstring1, sizeof(coordsstring1),"{CD5656}PRP{FFFFFF} Motorsystem");
    {
    format(insgesamtstring, sizeof(insgesamtstring),"{CD5656}Hilfe: /vc((Motor/Licht/Lock/Radio))");
    ShowPlayerDialog(playerid, StatsDialoge, DIALOG_STYLE_MSGBOX, coordsstring1, insgesamtstring, "Schließen", "");
    }
    return 1;
    }