Auto Spawn [Ich spawne nicht im Auto]

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
  • Hey Leute ich habe ein Problem ich habe versucht mir eine Roller vermietung zu scripten..
    Das hat auch alles geklappt,aber ich spawne nicht auf dem Roller wie es im Script steht PutPlayerInVehicle(playerid, rollermieten, 0);


    Befehl:


    }
    if(strcmp(cmdtext,"/rollermieten",true)==0)
    {

    new Float:x,Float:y,Float:z;
    new rollermieten;

    if(!IsPlayerInRangeOfPoint(playerid,5.0,-57.3292,-1576.5763,2.6107)) return SendClientMessage(playerid,WEIß,"Du bist nicht an der Roller vermietung.");
    GetPlayerPos(playerid,x,y,z);
    PutPlayerInVehicle(playerid, rollermieten, 0);
    rollermieten=CreateVehicle(462,x+2,y+2,z,151,151,151,151);
    GivePlayerMoney(playerid,-50);
    // SetVehicleHealth(rollermieten, 100);//Der Roller explodiert beim spawnen..


    SendClientMessage(playerid,WEIß,"Herzlichen Glückwunsch du hast dir ein Roller für 50$ gemietet.");


    return 1;


    Ich hoffe ihr könnt mir helfen.. ;)


    Mfg Mars

    **~~Favorite~~**

  • if(strcmp(cmdtext,"/unrentroller",true)==0)
    {
    DestroyVehicle(rollermieten[playerid]);
    }

    /edit l weggemacht


    Da bekomme ich errors


    Errors :
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(714) : warning 225: unreachable code
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(716) : error 028: invalid subscript (not an array or too many subscripts): "rollermieten"
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(716) : warning 215: expression has no effect
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(716) : error 001: expected token: ";", but found "]"
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(716) : error 029: invalid expression, assumed zero
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(716) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

    **~~Favorite~~**

  • @Inter..


    Wenn du das hier meinst:


    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(cmdtext,"/bsn",true)==0)
    {
    if(isPlayerAnAdmin(playerid,3))
    {
    ShowPlayerDialog(playerid,DIALOG_TUTORIAL,DIALOG_STYLE_MSGBOX,"BSN","Möchten sie wirklich zum BSN?","JA","NEIN");
    return 1;
    }
    SendClientMessage(playerid,BLAU,"Du bist kein Admin.");
    return 1;
    }
    if(strcmp(cmdtext,"/kill",true)==0)
    {
    if(isPlayerAnAdmin(playerid,1))
    {
    SetPlayerHealth(playerid,0);
    SendClientMessage(playerid,ORANGE,"Du hast dich selbst getötet..");
    return 1;
    }
    SendClientMessage(playerid,BLAU,"Du bist kein Admin.");
    return 1;

    }
    if(strcmp(cmdtext,"/spawn",true)==0)
    {
    if(isPlayerAnAdmin(playerid,1))
    {
    SpawnPlayer(playerid);
    SendClientMessage(playerid,ORANGE,"Du hast dich gespawnt.");
    return 1;
    }
    SendClientMessage(playerid,BLAU,"Du bist kein Admin.");
    return 1;

    }
    if(strcmp(cmdtext,"/serverinfo",true)==0)
    {
    SendClientMessage(playerid,LOGINGRÜN,"====Serverinfo====");
    SendClientMessage(playerid,LOGINGRÜN,"Scripter:[FD]Mars");
    SendClientMessage(playerid,LOGINGRÜN,"Projectleiter:[FD]Mars [FD]Barney");
    SendClientMessage(playerid,LOGINGRÜN,"Mapper:[FD]Barney");
    SendClientMessage(playerid,LOGINGRÜN,"Version: v0.0.4");
    SendClientMessage(playerid,LOGINGRÜN,"====Serverinfo====");

    return 1;
    ///---Goto´s Positionen---///


    }
    if(strcmp(cmdtext,"/teleports",true)==0)
    {


    SendClientMessage(playerid,ORANGE,"===Teleports===");
    SendClientMessage(playerid,ROT,"===Orte===");
    SendClientMessage(playerid,ORANGE,"/ls");
    SendClientMessage(playerid,ORANGE,"/sf");
    SendClientMessage(playerid,ORANGE,"/lv");
    SendClientMessage(playerid,ORANGE,"/bsn");
    SendClientMessage(playerid,ORANGE,"/zivispawn");
    SendClientMessage(playerid,ROT,"===Basen===");
    SendClientMessage(playerid,ORANGE,"/terrorbase");
    SendClientMessage(playerid,ORANGE,"/sanitäterbase");
    SendClientMessage(playerid,ORANGE,"/lspdbase");
    SendClientMessage(playerid,ORANGE,"/sfpdbase");
    SendClientMessage(playerid,ORANGE,"/bundeswehrbase");


    return 1;

    }
    if(strcmp(cmdtext,"/terrorbase",true)==0)
    {

    SetPlayerPos(playerid,-294.9917,1483.6819,75.5780); // Terrorbase
    SendClientMessage(playerid,ORANGE,"Willkommen an der Terroristen Base.");


    return 1;

    }
    if(strcmp(cmdtext,"/zivispawn",true)==0)
    {


    SetPlayerPos(playerid,-66.2650,-1586.7811,2.6172); // Zivispawn
    SendClientMessage(playerid,ORANGE,"Willkommen am Zivispawn.");


    return 1;


    }
    if(strcmp(cmdtext,"/ls",true)==0)
    {

    SetPlayerPos(playerid,1528.3860,-1701.8203,13.3828); // Los Santos vor dem LSPD.
    SendClientMessage(playerid,ORANGE,"Willkommen in Los Santos.");


    return 1;

    }
    if(strcmp(cmdtext,"/sf",true)==0)
    {

    SetPlayerPos(playerid,-1728.2520,-580.1295,16.3359); // San Firro vor dem Airport.
    SendClientMessage(playerid,ORANGE,"Willkommen in San Fierro.");


    return 1;

    }
    if(strcmp(cmdtext,"/lv",true)==0)
    {

    SetPlayerPos(playerid,2055.4841,1923.2759,12.1704); // Las Venturas vor Brunnen.
    SendClientMessage(playerid,ORANGE,"Willkommen in Las Venturas.");


    return 1;


    }
    if(strcmp(cmdtext,"/sanitäterbase",true)==0)
    {

    SetPlayerPos(playerid,1992.2811,-1463.3071,13.3906); // Jefferson Krankenhaus.
    SendClientMessage(playerid,ORANGE,"Willkommen an der Sanitäter Base.");


    return 1;

    }
    if(strcmp(cmdtext,"/lspdbase",true)==0)
    {

    SetPlayerPos(playerid,1542.7024,-1675.7030,13.5550); // LSPD.
    SendClientMessage(playerid,ORANGE,"Willkommen an der LSPD Base.");


    return 1;

    }
    if(strcmp(cmdtext,"/sfpdbase",true)==0)
    {

    SetPlayerPos(playerid,-1544.1174,663.1837,7.1875); // SFPD
    SendClientMessage(playerid,ORANGE,"Willkommen an der SFPD Base.");


    return 1;

    }
    if(strcmp(cmdtext,"/bundeswehrbase",true)==0)
    {

    SetPlayerPos(playerid,-1526.3364,507.0021,7.1797); // Neben dem SFPD.
    SendClientMessage(playerid,ORANGE,"Willkommen an der Bundeswehr Base.");


    return 1;



    }
    if(strcmp(cmdtext,"/givemoney",true)==0)
    {


    GivePlayerMoney(playerid,10000000);
    SendClientMessage(playerid,ORANGE,"Willkommen am Autohaus");


    return 1;

    ///---Goto´s Endung---///

    //---Help Befehl---///
    }
    if(strcmp(cmdtext,"/help",true)==0)
    {

    SendClientMessage(playerid,ORANGE,"---Hilfe---");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Allgemein:");
    SendClientMessage(playerid,WEIß,"Anderes:/carhelp ");


    return 1;

    ///---Help ended---//


    ///---Mieten---///

    }
    if(strcmp(cmdtext,"/rollermieten",true)==0)
    {

    new Float:x,Float:y,Float:z;
    new rollermieten;

    if(!IsPlayerInRangeOfPoint(playerid,5.0,-52.0638,-1573.6580,2.6172)) return SendClientMessage(playerid,WEIß,"Du bist nicht an der Roller vermietung.");
    GetPlayerPos(playerid,x,y,z);
    rollermieten=CreateVehicle(462,x+2,y+2,z,151,151,151,151);
    PutPlayerInVehicle(playerid, rollermieten, 0);
    GivePlayerMoney(playerid,-50);
    //SetVehicleHealth(rollermieten, 1000);


    SendClientMessage(playerid,WEIß,"Herzlichen Glückwunsch du hast dir ein Roller für 50$ gemietet.");


    return 1;


    if(strcmp(cmdtext,"/unrentroller",true)==0)
    {
    DestroyVehicle(rollermieten[playerid]);
    }



    ///---Mieten ende---///

    **~~Favorite~~**

  • Ja meinte ich

    //
    if(strcmp(cmdtext,"/rollermieten",true)==0)
    {
    new Float:x,Float:y,Float:z;
    new rollermieten;
    if(!IsPlayerInRangeOfPoint(playerid,5.0,-52.0638,-1573.6580,2.6172)) return SendClientMessage(playerid,WEIß,"Du bist nicht an der Roller vermietung.");
    GetPlayerPos(playerid,x,y,z);
    rollermieten=CreateVehicle(462,x+2,y+2,z,151,151,151,151);
    PutPlayerInVehicle(playerid, rollermieten, 0);
    GivePlayerMoney(playerid,-50);
    //SetVehicleHealth(rollermieten, 1000);
    SendClientMessage(playerid,WEIß,"Herzlichen Glückwunsch du hast dir ein Roller für 50$ gemietet.");
    return 1;
    }//Diese Klammer fehlte!
    if(strcmp(cmdtext,"/unrentroller",true)==0)
    {
    DestroyVehicle(rollermieten[playerid]);
    return 1;
    }
    //rest

  • Ne da irrst du nicht, fällt mir grade ein wo du das erwähnst.
    Man müsste das noch für den Spieler separieren.

    //zu den anderen
    new rollermieten[MAX_PLAYERS];
    //cmd
    if(strcmp(cmdtext,"/rollermieten",true)==0)
    {
    new Float:x,Float:y,Float:z;
    if(!IsPlayerInRangeOfPoint(playerid,5.0,-52.0638,-1573.6580,2.6172)) return SendClientMessage(playerid,WEIß,"Du bist nicht an der Roller vermietung.");
    GetPlayerPos(playerid,x,y,z);
    rollermieten[playerid] = CreateVehicle(462,x+2,y+2,z,151,151,151,151);
    PutPlayerInVehicle(playerid, rollermieten[playerid], 0);
    GivePlayerMoney(playerid,-50);
    //SetVehicleHealth(rollermieten, 1000);
    SendClientMessage(playerid,WEIß,"Herzlichen Glückwunsch du hast dir ein Roller für 50$ gemietet.");
    return 1;
    }//Diese Klammer fehlte!
    if(strcmp(cmdtext,"/unrentroller",true)==0)
    {
    DestroyVehicle(rollermieten[playerid]);
    return 1;
    }

  • Okay Benjamin klappt alles danke,aber das mit dem unrentroller geht nicht, ich poste hier mal die sachen..


    Befehl von dir:
    }
    if(strcmp(cmdtext,"/unrentroller",true)==0)
    {
    DestroyVehicle(rollermieten[playerid]);
    return 1;
    }


    Errors:


    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(392) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(423) : warning 219: local variable "pID" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(479) : warning 219: local variable "pID" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(490) : warning 219: local variable "pID" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(490) : warning 219: local variable "string" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(501) : warning 219: local variable "pID" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(501) : warning 219: local variable "string" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(715) : error 017: undefined symbol "rollermieten"
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(715) : warning 215: expression has no effect
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(715) : error 001: expected token: ";", but found "]"
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(715) : error 029: invalid expression, assumed zero
    C:\Users\Marcel\Desktop\USB\Sky is the Limit\gamemodes\sitl.pwn(715) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.


    Zeilen mit error :


    715 DestroyVehicle(rollermieten[playerid]);

    **~~Favorite~~**