Carkey System Funktioniert nicht, RemovePlayerFromVehicle funktioniert nicht

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,
    mein zweites Thema heute, nachdem das erste erledigt ist bahnt sich der nächste Fehler an, jedoch ohne Errors und Warnings:


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    //Ini
    new pname[MAX_PLAYER_NAME],ini[32];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(ini,sizeof(ini),"/Spieler/%s.ini",pname);
    new vehiclemod = GetVehicleModel(vehicleid);
    //Besitzer
    new vehid = GetPlayerVehicleID(playerid);
    new textIniCar[32];
    format(textIniCar,sizeof(textIniCar),"/Cars/Car_%d.ini",vehid);
    new besitzer[256];
    new keya[256];
    new keyb[256];
    besitzer = dini_Get(textIniCar,"Besitzer");
    keya = dini_Get(textIniCar,"KeyA");
    keyb = dini_Get(textIniCar,"KeyB");
    if(strcmp(besitzer,pname) || strcmp(keya,pname) || strcmp(keyb,pname))
    {
    //Besitzer
    //Motorschaden
    new Float:vehhealth;
    GetVehicleHealth(vehicleid,vehhealth);
    if (vehhealth < 252)
    {
    SendClientMessage(playerid,RED,"Du hast einen Motorschaden!");
    RemovePlayerFromVehicle(playerid);
    }
    //Motorschaden
    //Motorräder
    if(vehiclemod == 481 || vehiclemod == 510 || vehiclemod == 462 || vehiclemod == 581 || vehiclemod == 522 || vehiclemod == 461 || vehiclemod == 521 || vehiclemod == 523 || vehiclemod == 463 || vehiclemod == 468 || vehiclemod == 471)//Motorräder
    {
    if(pinfo[playerid][motorradschein] == 1)
    {
    }
    if(pinfo[playerid][motorradschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Motorradführerschein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Motorräder
    //Autos
    if(vehiclemod == 480 || vehiclemod == 422 || vehiclemod == 482 ||
    vehiclemod == 413 || vehiclemod == 535 || vehiclemod == 412 ||
    vehiclemod == 400 || vehiclemod == 500 || vehiclemod == 470 ||
    vehiclemod == 489 || vehiclemod == 416 || vehiclemod == 438 ||
    vehiclemod == 596 || vehiclemod == 598 || vehiclemod == 597 ||
    vehiclemod == 599 || vehiclemod == 420 || vehiclemod == 507 ||
    vehiclemod == 562 || vehiclemod == 585 || vehiclemod == 426 ||
    vehiclemod == 547 || vehiclemod == 560 || vehiclemod == 429 ||
    vehiclemod == 402 || vehiclemod == 541 || vehiclemod == 589 ||
    vehiclemod == 565 || vehiclemod == 411 || vehiclemod == 506 ||
    vehiclemod == 451 || vehiclemod == 558 || vehiclemod == 477 || vehiclemod == 418)//Autos
    {
    if(pinfo[playerid][autoschein] == 1)
    {
    }
    if(pinfo[playerid][autoschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Autoführerschein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Autos
    //Air
    if(vehiclemod == 511 || vehiclemod == 593 || vehiclemod == 460 || vehiclemod == 487 || vehiclemod == 488 || vehiclemod == 497 || vehiclemod == 469 || vehiclemod == 519)//Helis/Flugzeuge
    {
    if(pinfo[playerid][heliflugzeug] == 1)
    {
    }
    if(pinfo[playerid][heliflugzeug] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Air-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Air
    //Sonder
    if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432)//Sonder
    {
    if(pinfo[playerid][sonderschein] == 1)
    {
    }
    if(pinfo[playerid][sonderschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Sonder-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Sonder
    //Boote
    if(vehiclemod == 473 || vehiclemod == 493 || vehiclemod == 484 || vehiclemod == 453 || vehiclemod == 452 || vehiclemod == 446 || vehiclemod == 454)//Boote
    {
    if(pinfo[playerid][bootschein] == 1)
    {
    }
    if(pinfo[playerid][bootschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Boots-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Boote
    //LKW
    if(vehiclemod == 431 || vehiclemod == 437 || vehiclemod == 498 || vehiclemod == 524 || vehiclemod == 578 || vehiclemod == 455 || vehiclemod == 403 || vehiclemod == 514 || vehiclemod == 515)//Sonder
    {
    if(pinfo[playerid][lkwschein] == 1)
    {
    }
    if(pinfo[playerid][lkwschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen LKW-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //LKW
    }
    if(!strcmp(besitzer,pname) || !strcmp(keya,pname) || !strcmp(keyb,pname))
    {
    RemovePlayerFromVehicle(playerid);
    }
    return 1;
    }


    Wenn ich in ein Auto einsteige das nicht mir gehört und von dem ich keine Keys habe sollte es mich "Removen", was es aber nicht tut.
    Hab extra im SAMP Wiki nachgeschaut ob ich etwas falsch geschrieben habe, habe ich aber nicht.


    Ich hoffe ihr könnt mir Helfen.


    mfg
    Haidi

  • new Float:vehhealth;
    GetVehicleHealth(vehicleid,vehhealth);
    if (vehhealth < 252)
    {
    SendClientMessage(playerid,RED,"Du hast einen Motorschaden!");
    RemovePlayerFromVehicle(playerid);
    }


    probier mal "vehicleid" durch "vehid" zu ersetzen.

    **************************************************
    -Homers Light Roleplay (Unique script)
    -Server IP: 46.4.62.81:8996
    -Server Forum: http://www.hl-rp.forumprofi.de
    **************************************************

  • Hab das mal geändert. Hilft aber nichts.
    Der geänderte Code:
    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    //Ini
    new pname[MAX_PLAYER_NAME],ini[32];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(ini,sizeof(ini),"/Spieler/%s.ini",pname);
    new vehiclemod = GetVehicleModel(vehicleid);
    //Besitzer
    new vehid = GetPlayerVehicleID(playerid);
    new textIniCar[32];
    format(textIniCar,sizeof(textIniCar),"/Cars/Car_%d.ini",vehid);
    new besitzer[256];
    new keya[256];
    new keyb[256];
    besitzer = dini_Get(textIniCar,"Besitzer");
    keya = dini_Get(textIniCar,"KeyA");
    keyb = dini_Get(textIniCar,"KeyB");
    if(strcmp(besitzer,pname) || strcmp(keya,pname) || strcmp(keyb,pname))
    {
    //Besitzer
    //Motorschaden
    new Float:vehhealth;
    GetVehicleHealth(vehid,vehhealth);
    if (vehhealth < 252)
    {
    SendClientMessage(playerid,RED,"Du hast einen Motorschaden!");
    RemovePlayerFromVehicle(playerid);
    }
    //Motorschaden
    //Motorräder
    if(vehiclemod == 481 || vehiclemod == 510 || vehiclemod == 462 || vehiclemod == 581 || vehiclemod == 522 || vehiclemod == 461 || vehiclemod == 521 || vehiclemod == 523 || vehiclemod == 463 || vehiclemod == 468 || vehiclemod == 471)//Motorräder
    {
    if(pinfo[playerid][motorradschein] == 1)
    {
    }
    if(pinfo[playerid][motorradschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Motorradführerschein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Motorräder
    //Autos
    if(vehiclemod == 480 || vehiclemod == 422 || vehiclemod == 482 ||
    vehiclemod == 413 || vehiclemod == 535 || vehiclemod == 412 ||
    vehiclemod == 400 || vehiclemod == 500 || vehiclemod == 470 ||
    vehiclemod == 489 || vehiclemod == 416 || vehiclemod == 438 ||
    vehiclemod == 596 || vehiclemod == 598 || vehiclemod == 597 ||
    vehiclemod == 599 || vehiclemod == 420 || vehiclemod == 507 ||
    vehiclemod == 562 || vehiclemod == 585 || vehiclemod == 426 ||
    vehiclemod == 547 || vehiclemod == 560 || vehiclemod == 429 ||
    vehiclemod == 402 || vehiclemod == 541 || vehiclemod == 589 ||
    vehiclemod == 565 || vehiclemod == 411 || vehiclemod == 506 ||
    vehiclemod == 451 || vehiclemod == 558 || vehiclemod == 477 || vehiclemod == 418)//Autos
    {
    if(pinfo[playerid][autoschein] == 1)
    {
    }
    if(pinfo[playerid][autoschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Autoführerschein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Autos
    //Air
    if(vehiclemod == 511 || vehiclemod == 593 || vehiclemod == 460 || vehiclemod == 487 || vehiclemod == 488 || vehiclemod == 497 || vehiclemod == 469 || vehiclemod == 519)//Helis/Flugzeuge
    {
    if(pinfo[playerid][heliflugzeug] == 1)
    {
    }
    if(pinfo[playerid][heliflugzeug] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Air-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Air
    //Sonder
    if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432)//Sonder
    {
    if(pinfo[playerid][sonderschein] == 1)
    {
    }
    if(pinfo[playerid][sonderschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Sonder-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Sonder
    //Boote
    if(vehiclemod == 473 || vehiclemod == 493 || vehiclemod == 484 || vehiclemod == 453 || vehiclemod == 452 || vehiclemod == 446 || vehiclemod == 454)//Boote
    {
    if(pinfo[playerid][bootschein] == 1)
    {
    }
    if(pinfo[playerid][bootschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen Boots-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //Boote
    //LKW
    if(vehiclemod == 431 || vehiclemod == 437 || vehiclemod == 498 || vehiclemod == 524 || vehiclemod == 578 || vehiclemod == 455 || vehiclemod == 403 || vehiclemod == 514 || vehiclemod == 515)//Sonder
    {
    if(pinfo[playerid][lkwschein] == 1)
    {
    }
    if(pinfo[playerid][lkwschein] == 0)
    {
    SendClientMessage(playerid, SERVER, "Du hast keinen LKW-Schein!");
    SetPlayerWantedLevel(playerid, 1);
    }
    }
    //LKW
    }
    else if(!strcmp(besitzer,pname) || !strcmp(keya,pname) || !strcmp(keyb,pname))
    {
    TogglePlayerControllable(playerid, 0);
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid, 1);
    }
    return 1;
    }
    Jetzt ist das Problem das er mich in überhaupt kein Vehicle mehr lässt, auch nicht wenn ich den KeyA (zb) habe. Und auch nicht wenn ich der Besitzer des Vehicles bin.


    mfg
    Haidi

  • if(strcmp(besitzer,pname) || strcmp(keya,pname) || strcmp(keyb,pname))


    versuch mal:


    if((besitzer == x(oder welche id es bei auch ist) || (keyA == x) || (keyB == x))
    {
    ...
    }
    else
    ...

    **************************************************
    -Homers Light Roleplay (Unique script)
    -Server IP: 46.4.62.81:8996
    -Server Forum: http://www.hl-rp.forumprofi.de
    **************************************************