Problem bei Fühererschein

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
  • Unter welchem Callback verwendest du den geschilderten Ausschnitt? Falls du es in OnPlayerEnterVehicle verwendest, hast du einen Gedankenfehler. OnPlayerEnterVehicle wird ausgeführt, sobald der Client die 'Einsteigen-Taste' drückt. Um es dort zu verwenden, musst du seine X, Y und Z Koordinaten einfach nochmals setzen.

  • wie meinst du das


    So wie ich es sag. In welchem Callback verwendest du den Ausschnitt oben?

  • Versuch es mal so oder verwende deinen Code unter OnPlayerStateChange mit dem newstate PLAYER_STATE_DRIVER.



    if(PlayerInfo[playerid][BikeL] != 1)
    {
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(playerid, X, Y, Z);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }

  • Alternativ, wenn du dir nicht sicher bist....

    if(PlayerInfo[playerid][BikeL] != 1)
    {
    new Float:X, Float:Y, Float:Z;
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }


    lg :thumbup:

    RTL - Das N steht für Niveau!
    MfG,
    StreetS


    Jegliche Freundesanfragen, die für mich keinen Sinn ergeben, werden professionell Ignoriert. (Gleiche mit Skype!)
    Wer es nicht kapiert wird in Breadfish & Skype blockiert.


    - Stolzer PAWN Scripter der Klasse Beherrscht


  • Wenn du den Thread verfolgt hättest, hättest du bemerkt, dass dies unter OnPlayerEnterVehicle nicht möglich ist, da OnPlayerEnterVehicle ausgeführt wird, wenn der Spieler die Einsteigen-Taste drückt und nicht wenn er im Auto ist. Du kannst aber folgendes in OnPlayerStateChange verwenden:



    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][BikeL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }

  • jetzt kommen 26 errors


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    if(GetVehicleModel(vehicleid) == 448 || GetVehicleModel(vehicleid) == 461 || GetVehicleModel(vehicleid) == 462 || GetVehicleModel(vehicleid) == 463 || GetVehicleModel(vehicleid) == 468 || GetVehicleModel(vehicleid) == 471 || GetVehicleModel(vehicleid) == 521 || GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 523 || GetVehicleModel(vehicleid) == 581 || GetVehicleModel(vehicleid) == 586)

    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][BikeL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }



    if(GetVehicleModel(vehicleid) == 400 || GetVehicleModel(vehicleid) == 401 || GetVehicleModel(vehicleid) == 402 || GetVehicleModel(vehicleid) == 404 || GetVehicleModel(vehicleid) == 405 ||
    GetVehicleModel(vehicleid) == 409 || GetVehicleModel(vehicleid) == 410 || GetVehicleModel(vehicleid) == 411 || GetVehicleModel(vehicleid) == 412 || GetVehicleModel(vehicleid) == 413 ||
    GetVehicleModel(vehicleid) == 414 || GetVehicleModel(vehicleid) == 415 || GetVehicleModel(vehicleid) == 416 || GetVehicleModel(vehicleid) == 418 || GetVehicleModel(vehicleid) == 419 ||
    GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 421 || GetVehicleModel(vehicleid) == 422 || GetVehicleModel(vehicleid) == 423 || GetVehicleModel(vehicleid) == 424 ||
    GetVehicleModel(vehicleid) == 426 || GetVehicleModel(vehicleid) == 496 || GetVehicleModel(vehicleid) == 541 ||
    GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 428 || GetVehicleModel(vehicleid) == 429 || GetVehicleModel(vehicleid) == 434 || GetVehicleModel(vehicleid) == 436 ||
    GetVehicleModel(vehicleid) == 438 || GetVehicleModel(vehicleid) == 439 || GetVehicleModel(vehicleid) == 440 || GetVehicleModel(vehicleid) == 442 || GetVehicleModel(vehicleid) == 445 ||
    GetVehicleModel(vehicleid) == 451 || GetVehicleModel(vehicleid) == 458 || GetVehicleModel(vehicleid) == 459 || GetVehicleModel(vehicleid) == 466 || GetVehicleModel(vehicleid) == 467 ||
    GetVehicleModel(vehicleid) == 470 || GetVehicleModel(vehicleid) == 474 || GetVehicleModel(vehicleid) == 475 || GetVehicleModel(vehicleid) == 477 || GetVehicleModel(vehicleid) == 478 ||
    GetVehicleModel(vehicleid) == 479 || GetVehicleModel(vehicleid) == 480 || GetVehicleModel(vehicleid) == 482 || GetVehicleModel(vehicleid) == 483 || GetVehicleModel(vehicleid) == 489 ||
    GetVehicleModel(vehicleid) == 490 || GetVehicleModel(vehicleid) == 491 || GetVehicleModel(vehicleid) == 492 || GetVehicleModel(vehicleid) == 494 || GetVehicleModel(vehicleid) == 495 ||
    GetVehicleModel(vehicleid) == 498 || GetVehicleModel(vehicleid) == 499 || GetVehicleModel(vehicleid) == 500 || GetVehicleModel(vehicleid) == 502 || GetVehicleModel(vehicleid) == 503 ||
    GetVehicleModel(vehicleid) == 504 || GetVehicleModel(vehicleid) == 505 || GetVehicleModel(vehicleid) == 506 || GetVehicleModel(vehicleid) == 507 || GetVehicleModel(vehicleid) == 508 ||
    GetVehicleModel(vehicleid) == 516 || GetVehicleModel(vehicleid) == 517 || GetVehicleModel(vehicleid) == 518 || GetVehicleModel(vehicleid) == 525 || GetVehicleModel(vehicleid) == 526 ||
    GetVehicleModel(vehicleid) == 527 || GetVehicleModel(vehicleid) == 528 || GetVehicleModel(vehicleid) == 529 || GetVehicleModel(vehicleid) == 531 || GetVehicleModel(vehicleid) == 532 ||
    GetVehicleModel(vehicleid) == 533 || GetVehicleModel(vehicleid) == 534 || GetVehicleModel(vehicleid) == 535 || GetVehicleModel(vehicleid) == 536 || GetVehicleModel(vehicleid) == 540 ||
    GetVehicleModel(vehicleid) == 542 || GetVehicleModel(vehicleid) == 543 || GetVehicleModel(vehicleid) == 545 || GetVehicleModel(vehicleid) == 546 || GetVehicleModel(vehicleid) == 547 ||
    GetVehicleModel(vehicleid) == 549 || GetVehicleModel(vehicleid) == 550 || GetVehicleModel(vehicleid) == 551 || GetVehicleModel(vehicleid) == 552 || GetVehicleModel(vehicleid) == 554 ||
    GetVehicleModel(vehicleid) == 555 || GetVehicleModel(vehicleid) == 558 || GetVehicleModel(vehicleid) == 560 || GetVehicleModel(vehicleid) == 561 || GetVehicleModel(vehicleid) == 562 ||
    GetVehicleModel(vehicleid) == 565 || GetVehicleModel(vehicleid) == 566 || GetVehicleModel(vehicleid) == 567 || GetVehicleModel(vehicleid) == 568 || GetVehicleModel(vehicleid) == 573 ||
    GetVehicleModel(vehicleid) == 575 || GetVehicleModel(vehicleid) == 576 || GetVehicleModel(vehicleid) == 579 || GetVehicleModel(vehicleid) == 580 || GetVehicleModel(vehicleid) == 496 ||
    GetVehicleModel(vehicleid) == 582 || GetVehicleModel(vehicleid) == 585 || GetVehicleModel(vehicleid) == 587 || GetVehicleModel(vehicleid) == 588 || GetVehicleModel(vehicleid) == 589 ||
    GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599 || GetVehicleModel(vehicleid) == 600 ||
    GetVehicleModel(vehicleid) == 601 || GetVehicleModel(vehicleid) == 602 || GetVehicleModel(vehicleid) == 603 || GetVehicleModel(vehicleid) == 604 || GetVehicleModel(vehicleid) == 605 ||
    GetVehicleModel(vehicleid) == 609)


    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][CarL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Fühererschein");
    }
    }
    if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 ||
    GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 ||
    GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 ||
    GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 ||
    GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 511 ||
    GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 ||
    GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 ||
    GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 ||
    GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 ||
    GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][FlyL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Flugschein");
    }
    }


    return 1;
    }

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

  • Ich habe gedacht dass er Verstand hat und wüsste, dass man es mit dem newstate PLAYER_STATE_DRIVER und OnPlayerKeyStateChange muss.
    Ich kann Scripten, keine Sorge.


    lg :thumbup:


    OnPlayerKeyStateChange != OnPlayerStateChange.


    An EliteBread: Schau dir nochmals an was ich in meinem vorherigen Post gesagt habe, so wie du es jetzt machst wird es nicht funktionieren. Ebenfalls musst du vor return 1 noch eine Klammer zu machen.

  • habe oben den PWn code verändert mit deinen sachen aber egen wo ist ein fehler
    campel kannste mir das eben vlt machen muss essen

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

    Einmal editiert, zuletzt von EliteBread ()

  • Wie bereits gesagt, dir fehlt eine geschweifte Klammer:



    if(GetVehicleModel(vehicleid) == 448 || GetVehicleModel(vehicleid) == 461 || GetVehicleModel(vehicleid) == 462 || GetVehicleModel(vehicleid) == 463 || GetVehicleModel(vehicleid) == 468 || GetVehicleModel(vehicleid) == 471 || GetVehicleModel(vehicleid) == 521 || GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 523 || GetVehicleModel(vehicleid) == 581 || GetVehicleModel(vehicleid) == 586)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][BikeL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }
    } // <-- Diese Klammer fehlt.
    Und das Ganze muss in OnPlayerStateChange und nicht in OnPlayerEnterVehicle!

  • C:\Users\EliteBread\Desktop\Selfmade Script\gamemodes\Bread.pwn(2214) : error 017: undefined symbol "newstate"
    C:\Users\EliteBread\Desktop\Selfmade Script\gamemodes\Bread.pwn(2249) : error 017: undefined symbol "newstate"
    C:\Users\EliteBread\Desktop\Selfmade Script\gamemodes\Bread.pwn(2266) : error 017: undefined symbol "newstate"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    3 Errors.

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

  • Ich habe es nun etwa zehn mal gesagt: Und das Ganze muss in OnPlayerStateChange und nicht in OnPlayerEnterVehicle!

  • Wie binde ich das ein also dazu
    weil bin bissel verwirt,
    würde mich freuen wen es jemand eben machen könnte


    das:
    {
    if(GetVehicleModel(vehicleid) == 448 || GetVehicleModel(vehicleid) == 461 || GetVehicleModel(vehicleid) == 462 || GetVehicleModel(vehicleid) == 463 || GetVehicleModel(vehicleid) == 468 || GetVehicleModel(vehicleid) == 471 || GetVehicleModel(vehicleid) == 521 || GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 523 || GetVehicleModel(vehicleid) == 581 || GetVehicleModel(vehicleid) == 586)

    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][BikeL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }
    }



    if(GetVehicleModel(vehicleid) == 400 || GetVehicleModel(vehicleid) == 401 || GetVehicleModel(vehicleid) == 402 || GetVehicleModel(vehicleid) == 404 || GetVehicleModel(vehicleid) == 405 ||
    GetVehicleModel(vehicleid) == 409 || GetVehicleModel(vehicleid) == 410 || GetVehicleModel(vehicleid) == 411 || GetVehicleModel(vehicleid) == 412 || GetVehicleModel(vehicleid) == 413 ||
    GetVehicleModel(vehicleid) == 414 || GetVehicleModel(vehicleid) == 415 || GetVehicleModel(vehicleid) == 416 || GetVehicleModel(vehicleid) == 418 || GetVehicleModel(vehicleid) == 419 ||
    GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 421 || GetVehicleModel(vehicleid) == 422 || GetVehicleModel(vehicleid) == 423 || GetVehicleModel(vehicleid) == 424 ||
    GetVehicleModel(vehicleid) == 426 || GetVehicleModel(vehicleid) == 496 || GetVehicleModel(vehicleid) == 541 ||
    GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 428 || GetVehicleModel(vehicleid) == 429 || GetVehicleModel(vehicleid) == 434 || GetVehicleModel(vehicleid) == 436 ||
    GetVehicleModel(vehicleid) == 438 || GetVehicleModel(vehicleid) == 439 || GetVehicleModel(vehicleid) == 440 || GetVehicleModel(vehicleid) == 442 || GetVehicleModel(vehicleid) == 445 ||
    GetVehicleModel(vehicleid) == 451 || GetVehicleModel(vehicleid) == 458 || GetVehicleModel(vehicleid) == 459 || GetVehicleModel(vehicleid) == 466 || GetVehicleModel(vehicleid) == 467 ||
    GetVehicleModel(vehicleid) == 470 || GetVehicleModel(vehicleid) == 474 || GetVehicleModel(vehicleid) == 475 || GetVehicleModel(vehicleid) == 477 || GetVehicleModel(vehicleid) == 478 ||
    GetVehicleModel(vehicleid) == 479 || GetVehicleModel(vehicleid) == 480 || GetVehicleModel(vehicleid) == 482 || GetVehicleModel(vehicleid) == 483 || GetVehicleModel(vehicleid) == 489 ||
    GetVehicleModel(vehicleid) == 490 || GetVehicleModel(vehicleid) == 491 || GetVehicleModel(vehicleid) == 492 || GetVehicleModel(vehicleid) == 494 || GetVehicleModel(vehicleid) == 495 ||
    GetVehicleModel(vehicleid) == 498 || GetVehicleModel(vehicleid) == 499 || GetVehicleModel(vehicleid) == 500 || GetVehicleModel(vehicleid) == 502 || GetVehicleModel(vehicleid) == 503 ||
    GetVehicleModel(vehicleid) == 504 || GetVehicleModel(vehicleid) == 505 || GetVehicleModel(vehicleid) == 506 || GetVehicleModel(vehicleid) == 507 || GetVehicleModel(vehicleid) == 508 ||
    GetVehicleModel(vehicleid) == 516 || GetVehicleModel(vehicleid) == 517 || GetVehicleModel(vehicleid) == 518 || GetVehicleModel(vehicleid) == 525 || GetVehicleModel(vehicleid) == 526 ||
    GetVehicleModel(vehicleid) == 527 || GetVehicleModel(vehicleid) == 528 || GetVehicleModel(vehicleid) == 529 || GetVehicleModel(vehicleid) == 531 || GetVehicleModel(vehicleid) == 532 ||
    GetVehicleModel(vehicleid) == 533 || GetVehicleModel(vehicleid) == 534 || GetVehicleModel(vehicleid) == 535 || GetVehicleModel(vehicleid) == 536 || GetVehicleModel(vehicleid) == 540 ||
    GetVehicleModel(vehicleid) == 542 || GetVehicleModel(vehicleid) == 543 || GetVehicleModel(vehicleid) == 545 || GetVehicleModel(vehicleid) == 546 || GetVehicleModel(vehicleid) == 547 ||
    GetVehicleModel(vehicleid) == 549 || GetVehicleModel(vehicleid) == 550 || GetVehicleModel(vehicleid) == 551 || GetVehicleModel(vehicleid) == 552 || GetVehicleModel(vehicleid) == 554 ||
    GetVehicleModel(vehicleid) == 555 || GetVehicleModel(vehicleid) == 558 || GetVehicleModel(vehicleid) == 560 || GetVehicleModel(vehicleid) == 561 || GetVehicleModel(vehicleid) == 562 ||
    GetVehicleModel(vehicleid) == 565 || GetVehicleModel(vehicleid) == 566 || GetVehicleModel(vehicleid) == 567 || GetVehicleModel(vehicleid) == 568 || GetVehicleModel(vehicleid) == 573 ||
    GetVehicleModel(vehicleid) == 575 || GetVehicleModel(vehicleid) == 576 || GetVehicleModel(vehicleid) == 579 || GetVehicleModel(vehicleid) == 580 || GetVehicleModel(vehicleid) == 496 ||
    GetVehicleModel(vehicleid) == 582 || GetVehicleModel(vehicleid) == 585 || GetVehicleModel(vehicleid) == 587 || GetVehicleModel(vehicleid) == 588 || GetVehicleModel(vehicleid) == 589 ||
    GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599 || GetVehicleModel(vehicleid) == 600 ||
    GetVehicleModel(vehicleid) == 601 || GetVehicleModel(vehicleid) == 602 || GetVehicleModel(vehicleid) == 603 || GetVehicleModel(vehicleid) == 604 || GetVehicleModel(vehicleid) == 605 ||
    GetVehicleModel(vehicleid) == 609)


    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][CarL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Fühererschein");
    }
    }
    if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 ||
    GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 ||
    GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 ||
    GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 ||
    GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 511 ||
    GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 ||
    GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 ||
    GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 ||
    GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 ||
    GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][FlyL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Flugschein");
    }
    }


    return 1;
    }


    mit in:


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    new carid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
    Speedo(playerid,1);
    if(IsANewbie(carid))
    {
    if(PlayerInfo[playerid][Level] > 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nur bis Level 3 Fahren"), RemovePlayerFromVehicle(playerid);
    }


    if(IsAAirportCar(carid))
    {
    if(PlayerInfo[playerid][Level] < 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du erst ab Level 3 Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsALSPDCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 1) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAFBICar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 2) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAArmiCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAMedicCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 4) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAFahrschulCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 5) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    /*if(IsATaxiCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 6) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }*/
    if(IsAPresidentCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 7) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsANewsCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 8) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAGrooveCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 9) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsALCNCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 10) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsABallasCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 11) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsABikerCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 12) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAVagosCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 13) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAYakuzaCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 14) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsARifaCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 15) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsATerrorCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 16) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }


    }
    if(newstate == PLAYER_STATE_ONFOOT)
    {
    Speedo(playerid,0);
    }
    return 1;
    }

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

    2 Mal editiert, zuletzt von EliteBread () aus folgendem Grund: 3x text

  • Du kopierst einfach alles und fügst es über return 1 bei OnPlayerStateChange ein. Du kannst es auch unter der ersten geschweiften Klammer einfügen.


  • public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(GetVehicleModel(vehicleid) == 448 || GetVehicleModel(vehicleid) == 461 || GetVehicleModel(vehicleid) == 462 || GetVehicleModel(vehicleid) == 463 || GetVehicleModel(vehicleid) == 468 || GetVehicleModel(vehicleid) == 471 || GetVehicleModel(vehicleid) == 521 ||
    GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 523 || GetVehicleModel(vehicleid) == 581 || GetVehicleModel(vehicleid) == 586)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][BikeL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Motorradschein");
    }
    }


    if(GetVehicleModel(vehicleid) == 400 || GetVehicleModel(vehicleid) == 401 || GetVehicleModel(vehicleid) == 402 || GetVehicleModel(vehicleid) == 404 || GetVehicleModel(vehicleid) == 405 ||
    GetVehicleModel(vehicleid) == 409 || GetVehicleModel(vehicleid) == 410 || GetVehicleModel(vehicleid) == 411 || GetVehicleModel(vehicleid) == 412 || GetVehicleModel(vehicleid) == 413 ||
    GetVehicleModel(vehicleid) == 414 || GetVehicleModel(vehicleid) == 415 || GetVehicleModel(vehicleid) == 416 || GetVehicleModel(vehicleid) == 418 || GetVehicleModel(vehicleid) == 419 ||
    GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 421 || GetVehicleModel(vehicleid) == 422 || GetVehicleModel(vehicleid) == 423 || GetVehicleModel(vehicleid) == 424 ||
    GetVehicleModel(vehicleid) == 426 || GetVehicleModel(vehicleid) == 496 || GetVehicleModel(vehicleid) == 541 ||
    GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 428 || GetVehicleModel(vehicleid) == 429 || GetVehicleModel(vehicleid) == 434 || GetVehicleModel(vehicleid) == 436 ||
    GetVehicleModel(vehicleid) == 438 || GetVehicleModel(vehicleid) == 439 || GetVehicleModel(vehicleid) == 440 || GetVehicleModel(vehicleid) == 442 || GetVehicleModel(vehicleid) == 445 ||
    GetVehicleModel(vehicleid) == 451 || GetVehicleModel(vehicleid) == 458 || GetVehicleModel(vehicleid) == 459 || GetVehicleModel(vehicleid) == 466 || GetVehicleModel(vehicleid) == 467 ||
    GetVehicleModel(vehicleid) == 470 || GetVehicleModel(vehicleid) == 474 || GetVehicleModel(vehicleid) == 475 || GetVehicleModel(vehicleid) == 477 || GetVehicleModel(vehicleid) == 478 ||
    GetVehicleModel(vehicleid) == 479 || GetVehicleModel(vehicleid) == 480 || GetVehicleModel(vehicleid) == 482 || GetVehicleModel(vehicleid) == 483 || GetVehicleModel(vehicleid) == 489 ||
    GetVehicleModel(vehicleid) == 490 || GetVehicleModel(vehicleid) == 491 || GetVehicleModel(vehicleid) == 492 || GetVehicleModel(vehicleid) == 494 || GetVehicleModel(vehicleid) == 495 ||
    GetVehicleModel(vehicleid) == 498 || GetVehicleModel(vehicleid) == 499 || GetVehicleModel(vehicleid) == 500 || GetVehicleModel(vehicleid) == 502 || GetVehicleModel(vehicleid) == 503 ||
    GetVehicleModel(vehicleid) == 504 || GetVehicleModel(vehicleid) == 505 || GetVehicleModel(vehicleid) == 506 || GetVehicleModel(vehicleid) == 507 || GetVehicleModel(vehicleid) == 508 ||
    GetVehicleModel(vehicleid) == 516 || GetVehicleModel(vehicleid) == 517 || GetVehicleModel(vehicleid) == 518 || GetVehicleModel(vehicleid) == 525 || GetVehicleModel(vehicleid) == 526 ||
    GetVehicleModel(vehicleid) == 527 || GetVehicleModel(vehicleid) == 528 || GetVehicleModel(vehicleid) == 529 || GetVehicleModel(vehicleid) == 531 || GetVehicleModel(vehicleid) == 532 ||
    GetVehicleModel(vehicleid) == 533 || GetVehicleModel(vehicleid) == 534 || GetVehicleModel(vehicleid) == 535 || GetVehicleModel(vehicleid) == 536 || GetVehicleModel(vehicleid) == 540 ||
    GetVehicleModel(vehicleid) == 542 || GetVehicleModel(vehicleid) == 543 || GetVehicleModel(vehicleid) == 545 || GetVehicleModel(vehicleid) == 546 || GetVehicleModel(vehicleid) == 547 ||
    GetVehicleModel(vehicleid) == 549 || GetVehicleModel(vehicleid) == 550 || GetVehicleModel(vehicleid) == 551 || GetVehicleModel(vehicleid) == 552 || GetVehicleModel(vehicleid) == 554 ||
    GetVehicleModel(vehicleid) == 555 || GetVehicleModel(vehicleid) == 558 || GetVehicleModel(vehicleid) == 560 || GetVehicleModel(vehicleid) == 561 || GetVehicleModel(vehicleid) == 562 ||
    GetVehicleModel(vehicleid) == 565 || GetVehicleModel(vehicleid) == 566 || GetVehicleModel(vehicleid) == 567 || GetVehicleModel(vehicleid) == 568 || GetVehicleModel(vehicleid) == 573 ||
    GetVehicleModel(vehicleid) == 575 || GetVehicleModel(vehicleid) == 576 || GetVehicleModel(vehicleid) == 579 || GetVehicleModel(vehicleid) == 580 || GetVehicleModel(vehicleid) == 496 ||
    GetVehicleModel(vehicleid) == 582 || GetVehicleModel(vehicleid) == 585 || GetVehicleModel(vehicleid) == 587 || GetVehicleModel(vehicleid) == 588 || GetVehicleModel(vehicleid) == 589 ||
    GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599 || GetVehicleModel(vehicleid) == 600 ||
    GetVehicleModel(vehicleid) == 601 || GetVehicleModel(vehicleid) == 602 || GetVehicleModel(vehicleid) == 603 || GetVehicleModel(vehicleid) == 604 || GetVehicleModel(vehicleid) == 605 ||
    GetVehicleModel(vehicleid) == 609)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][CarL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Fühererschein");
    }
    }
    if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 ||
    GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 ||
    GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 ||
    GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 ||
    GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 511 ||
    GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 ||
    GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 ||
    GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 ||
    GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 ||
    GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593)
    {
    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[playerid][FlyL] != 1)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, Rot, "Du hast keinen Flugschein");
    }
    }


    new carid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
    Speedo(playerid,1);
    if(IsANewbie(carid))
    {
    if(PlayerInfo[playerid][Level] > 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nur bis Level 3 Fahren"), RemovePlayerFromVehicle(playerid);
    }


    if(IsAAirportCar(carid))
    {
    if(PlayerInfo[playerid][Level] < 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du erst ab Level 3 Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsALSPDCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 1) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAFBICar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 2) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAArmiCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 3) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAMedicCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 4) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAFahrschulCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 5) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    /*if(IsATaxiCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 6) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }*/
    if(IsAPresidentCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 7) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsANewsCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 8) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAGrooveCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 9) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsALCNCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 10) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsABallasCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 11) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsABikerCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 12) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAVagosCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 13) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsAYakuzaCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 14) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsARifaCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 15) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }
    if(IsATerrorCar(carid))
    {
    if(PlayerInfo[playerid][Beruf] != 16) SendClientMessage(playerid,Rot,"Dieses Fahrzeug darfst du nicht Benutzen"), RemovePlayerFromVehicle(playerid);
    }


    }


    if(newstate == PLAYER_STATE_ONFOOT)
    {
    Speedo(playerid,0);
    }
    return 1;
    }

    Schau dir auch mal else und elseif an, du machst hier sehr viele sehr unnötige Abfragen.