Vehicle Spawner im Dialog

  • Vehicle Spawner im Dialog

    Hallo, ich stelle euch mal meinen /newcar Befehl vor.
    Dieser basiert auf einem Vehicle-Spawner-Im-Dialog-System.
    Sie ist jedoch von mir gekürzt, da dieser Befehl bei mir ein Adminbefehl ist ^^

    Ich gebe nur /newcar ein und er zeigt mir Flugzeuge, Fahrzeuge (Teil 1, 2 & 3), Boote und Anhänger an.
    Spoiler anzeigen

    [pwn]
    #define function:%1(%2) forward %1(%2); public %1(%2)
    if(!strcmp(cmdtext,"/newcar",true))
    {
    ShowPlayerDialog(playerid,Dialog_NewCar_VehicleSorts,DIALOG_STYLE_LIST,"{00FF00}Fahrzeug-Sorten - Admincar erstellen",ReturnAllKindsOfVehicles(),"Auswählen","Abbrechen");
    return 1;
    }
    case Dialog_NewCar_VehicleSorts:
    {
    if(response)
    {
    switch(listitem)
    {
    case 0:
    {
    SetPVarInt(playerid,"NewCar",1);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Flugzeuge/Helis - NewCar Auswahl",ReturnAirVehicles(),"Auswählen","Zurück");
    return 1;
    }
    case 1:
    {
    SetPVarInt(playerid,"NewCar",2);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Landfahrzeuge - NewCar Auswahl",ReturnLandVehicles(),"Auswählen","Zurück");
    return 1;
    }
    case 2:
    {
    SetPVarInt(playerid,"NewCar",5);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Landfahrzeuge Teil 2 - NewCar",ReturnLandVehiclesSecond(),"Auswählen","Zurück");
    return 1;
    }
    case 3:
    {
    SetPVarInt(playerid,"NewCar",6);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Landfahrzeuge Teil 3 - NewCar",ReturnLandVehiclesThird(),"Auswählen","Zurück");
    return 1;
    }
    case 4:
    {
    SetPVarInt(playerid,"NewCar",3);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Boote - NewCar Auswahl",ReturnSeaVehicles(),"Auswählen","Zurück");
    return 1;
    }
    case 5:
    {
    SetPVarInt(playerid,"NewCar",4);
    ShowPlayerDialog(playerid,Dialog_ChooseNewCar,DIALOG_STYLE_LIST,"{00FF00}Anhänger - NewCar Auswahl",ReturnAllTrailers(),"Auswählen","Zurück");
    return 1;
    }
    }
    }
    }
    case Dialog_ChooseNewCar:
    {
    if(response)
    {
    if(GetPVarInt(playerid,"NewCar") == 1) // 1 == Flugzeuge/Helis
    {
    new j = ReturnAirVehicleNumber();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    CreateVehicle(GetModelIDOfAirVehicle(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1);

    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else if(GetPVarInt(playerid,"NewCar") == 2) // 2 == Landfahrzeuge
    {
    new j = ReturnLandVehicleNumber();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    CreateVehicle(GetModelIDOfLandVehicle(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1); //

    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else if(GetPVarInt(playerid,"NewCar") == 3) // 3 == Boote
    {
    new j = ReturnBootVehicleNumber();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    CreateVehicle(GetModelIDOfBootVehicle(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1); //

    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else if(GetPVarInt(playerid,"NewCar") == 4) // 4 == Anhänger
    {
    new j = ReturnTrailerNumber();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    AddStaticVehicleEx(GetModelIDOfTrailer(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1); //

    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else if(GetPVarInt(playerid,"NewCar") == 5) // 5 == Landfahrzeuge Teil 2
    {
    new j = ReturnLandVehicleNumberSecond();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    CreateVehicle(GetModelIDOfLandVehicleSecond(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1); //

    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else if(GetPVarInt(playerid,"NewCar") == 6) // 6 == Landfahrzeuge Teil 3
    {
    new j = ReturnLandVehicleNumberThird();
    for(new k = 0; k < j; k++)
    {
    if(listitem == k)
    {
    new Float:x,Float:y,Float:z,Float:rotation;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,rotation);
    CreateVehicle(GetModelIDOfLandVehicleThird(k),x+2,y+2,z,rotation,0+random(126),0+random(126),-1);
    DeletePVar(playerid,"NewCar");
    return 1;
    }
    }
    }
    else return SendClientMessage(playerid,Color_Rot,"Error! Es gab einen Fehler, probier es bitte noch einmal!");
    }
    else
    {
    DeletePVar(playerid,"NewCar");
    ShowPlayerDialog(playerid,Dialog_NewCar_VehicleSorts,DIALOG_STYLE_LIST,"{00FF00}Fahrzeug-Sorten - Admincar erstellen",ReturnAllKindsOfVehicles(),"Auswählen","Abbrechen");
    return 1;
    }
    }

    ReturnAllKindsOfVehicles()
    {
    new string[150];
    format(string,sizeof(string),"Flugzeuge/Helis\nLandfahrzeuge(bis ID:502)\nLandfahrzeuge(bis ID:603)\nLandfahrzeuge(Rest)\nBoote\nAnhänger");
    return string;
    }
    ReturnAirVehicles()
    {
    new string[1024],i = 400;
    while(i != 612)
    {
    if(IstEinHeliOrPlane(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }

    ReturnLandVehicles()
    {
    new string[1024],i = 400;
    while(i != 503)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }
    ReturnLandVehiclesSecond()
    {
    new string[1024],i = 503;
    while(i != 604)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }
    ReturnLandVehiclesThird()
    {
    new string[1024],i = 604;
    while(i != 612)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }

    ReturnSeaVehicles()
    {
    new string[1024],i = 400;
    while(i != 612)
    {
    if(IstEinBoot(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }

    ReturnAllTrailers()
    {
    new string[1024],i = 400;
    while(i != 612)
    {
    if(IstEinTrailer(i))
    {
    format(string,sizeof(string),"%s\n%s(%d)",string,Carname[i-400],i);
    }
    i++;
    }
    return string;
    }
    GetModelIDOfAirVehicle(number)
    {
    new returnID = 0,i = 400;
    while(i != 612)
    {
    if(IstEinHeliOrPlane(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    GetModelIDOfLandVehicle(number)
    {
    new returnID = 0,i = 400;
    while(i != 503)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    GetModelIDOfLandVehicleSecond(number)
    {
    new returnID = 0,i = 503;
    while(i != 604)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    GetModelIDOfLandVehicleThird(number)
    {
    new returnID = 0,i = 604;
    while(i != 612)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    GetModelIDOfBootVehicle(number)
    {
    new returnID = 0,i = 400;
    while(i != 612)
    {
    if(IstEinBoot(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    GetModelIDOfTrailer(number)
    {
    new returnID = 0,i = 400;
    while(i != 612)
    {
    if(IstEinTrailer(i))
    {
    if(number == returnID) return i;
    returnID++;
    }
    i++;
    }
    return 0;
    }

    ReturnAirVehicleNumber()
    {
    new amount = 0,i = 400;
    while(i < 612)
    {
    if(IstEinHeliOrPlane(i))
    { amount++; }
    i++;
    }
    return amount;
    }

    ReturnLandVehicleNumber()
    {
    new amount = 0,i = 400;
    while(i != 503)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    amount++;
    }
    i++;
    }
    return amount;
    }

    ReturnLandVehicleNumberSecond()
    {
    new amount = 0,i = 503;
    while(i != 604)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    amount++;
    }
    i++;
    }
    return amount;
    }

    ReturnLandVehicleNumberThird()
    {
    new amount = 0,i = 604;
    while(i != 612)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBus(i) || IstEinFahrrad(i))
    {
    amount++;
    }
    i++;
    }
    return amount;
    }

    ReturnBootVehicleNumber()
    {
    new amount = 0,i = 400;
    while(i != 612)
    {
    if(IstEinBoot(i))
    {
    amount++;
    }
    i++;
    }
    return amount;
    }

    ReturnTrailerNumber()
    {
    new amount = 0,i = 400;
    while(i < 612)
    {
    if(IstEinTrailer(i))
    {
    amount++;
    }
    i++;
    }
    return amount;
    }
    function:IstEinAuto(a)
    {
    if(a == 400 || a == 401 || a == 402 || a == 404 || a == 405 || a == 406 || a == 407 || a == 408 || a == 409 || a == 410 || a == 411 || a == 412 || a == 413 || a == 414 || a == 415 || a == 416
    || a == 418 || a == 419 || a == 420 || a == 421 || a == 422 || a == 423 || a == 426 || a == 427 || a == 428 || a == 429 || a == 432 || a == 433 || a == 434 || a == 436
    || a == 438 || a == 439 || a == 440 || a == 442 || a == 444 || a == 445 || a == 451 || a == 458 || a == 459 || a == 466 || a == 467 || a == 470 || a == 475 || a == 477 || a == 478 || a == 479
    || a == 480 || a == 482 || a == 483 || a == 486 || a == 489 || a == 490 || a == 491 || a == 492 || a == 494 || a == 495 || a == 496 || a == 498 || a == 499 || a == 500 || a == 502 || a == 503
    || a == 504 || a == 505 || a == 506 || a == 507 || a == 508 || a == 516 || a == 517 || a == 518 || a == 525 || a == 526 || a == 527 || a == 528 || a == 529 || a == 532 || a == 533 || a == 534
    || a == 535 || a == 536 || a == 540 || a == 541 || a == 542 || a == 543 || a == 544 || a == 545 || a == 546 || a == 547 || a == 549 || a == 550 || a == 551 || a == 552 || a == 554 || a == 555
    || a == 556 || a == 557 || a == 558 || a == 559 || a == 560 || a == 561 || a == 562 || a == 565 || a == 566 || a == 567 || a == 568 || a == 575 || a == 576 || a == 579 || a == 580 || a == 582
    || a == 585 || a == 587 || a == 588 || a == 589 || a == 596 || a == 597 || a == 598 || a == 599 || a == 600 || a == 601 || a == 602 || a == 603 || a == 609 /*Kart etc*/ || a == 571 || a == 572 || a == 574 || a == 583) { return 1; }
    return 0;
    }
    function:IstEinFahrrad(a)
    {
    if(a == 481 || a == 509 || a == 510) { return 1; }
    return 0;
    }
    function:IstEinMotorrad(a)
    {
    if(a == 448 || a == 461 || a == 462 || a == 463 || a == 468 || a == 521 || a == 522 || a == 523 || a == 581 || a == 586) { return 1; }
    return 0;
    }
    function:IstEinBoot(a)
    {
    if(a == 430 || a == 446 || a == 452 || a == 453 || a == 454 || a == 472 || a == 473 || a == 484 || a == 493 || a == 595) { return 1; }
    return 0;
    }
    function:IstEinHeliOrPlane(a)
    {
    if(a == 417 || a == 425 || a == 447 || a == 460 || a == 469 || a == 476 || a == 487 || a == 488 || a == 497 || a == 511 || a == 512 || a == 513 || a == 519 || a == 520 || a == 548 || a == 553 || a == 563 || a == 577 || a == 592 || a == 593) { return 1; }
    return 0;
    }
    function:IstEinLKW(a)
    {
    if(a == 403 || a == 408 || a == 443 || a == 455 || a == 456 || a == 514 || a == 515) { return 1; }
    return 0;
    }
    function:IstEinZug(a)
    {
    if(a == 449 || a == 537 || a == 538) return 1;
    return 0;
    }
    function:IstEinBus(a)
    {
    if(a == 431 || a == 437) return 1;
    return 0;
    }
    function:IstEinTrailer(a)
    {
    if(a == 435 || a == 450 || a == 569 || a == 570 || a == 584 || a == 590 || a == 591 || a == 606 || a == 607 || a == 608 || a == 610 || a == 611) return 1;
    return 0;
    }
    function:IstEinMotorFahrzeug(i)
    {
    if(IstEinAuto(i) || IstEinMotorrad(i) || IstEinLKW(i) || IstEinBoot(i) || IstEinHeliOrPlane(i) || IstEinZug(i) || IstEinBus(i)) return 1;
    return 0;
    }
    [/pwn]


    Viel Spaß mit dem Befehl ^^

    Bitte nicht fragen wie man es einbaut.
    Es müsste eigentlich klar sein!

    Edit: Fehler entdeckt

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von NicoAiko ()