/veh Befehl [Help]

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
  • Guten Abend liebe Community,


    ich hoffe es kann mir jemand helfen, bzw erklären wo genau der Fehler liegt.
    Ich möchte den Befehl /veh also zum Auto spawnen ohne Admin System machen.
    Aber bei mir kommen jegliche Errors.



    if (strcmp("/veh", cmdtext, true, 10) == 0)
    {
    if(!strlen(strget(cmdtext,3))) return SendClientMessage(playerid, ROT,"Benutze /veh [VEHICLE] [COLOR1] [COLOR2]");


    {
    new medelid, col1, col2, car;
    new Float: FloatX, Float:FloatY, Float:FloatZ, Float:FloatA;


    GetPlayerPos(playerid, PosX, PosY, PosX);
    GetPlayerFacingAngle(playerid,PosZA);


    modelid = strval(strget(cmdtext,1));
    col1 = strval(strget(cmdtext,2));
    cal2 = strval(strget(cmdtext,3));


    car = AddStaticVehicle(modelid,PosX, PosY, PosZ, color1, color2);


    PutPlayerInVehicle(playerid,car,0);
    }
    }
    return 0;
    }



    Und hier die Errors ?(


    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(323) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(325) : warning 217: loose indentation
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(329) : error 017: undefined symbol "PosX"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(330) : error 017: undefined symbol "PosZA"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(332) : error 017: undefined symbol "modelid"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(332) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(333) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(334) : error 017: undefined symbol "cal2"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(334) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(336) : error 017: undefined symbol "modelid"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : warning 203: symbol is never used: "FloatA"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : warning 203: symbol is never used: "FloatZ"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : warning 203: symbol is never used: "FloatY"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : warning 203: symbol is never used: "FloatX"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(326) : warning 203: symbol is never used: "col2"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(333) : warning 204: symbol is assigned a value that is never used: "col1"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(326) : warning 203: symbol is never used: "medelid"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    9 Errors.


    Hoffe es kann mir einer helfen.


    mfg Neptun :thumbup: :thumbup:

  • ihr ich gebe dir mein musst nur noch anpassen:



    ocmd:veh(playerid,params[])
    {
    new Float:vehx,Float:vehy,Float:vehz;
    new vehid,cc1,cc2,string[128];
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 444 || GetVehicleModel(vehicleid) == 447)return SendClientMessage(playerid,ROT,"Dieses Fahrzeug können sie nicht Spawnen !");
    if(sscanf(params,"iii",vehid,cc1,cc2))return SendClientMessage(playerid, ROT,"Benutzung: /veh [Vehicle ID] [Farbe 1] [Farbe 2]");
    if(isPlayerAnAdmin(playerid,10))
    {
    GetPlayerPos(playerid,vehx,vehy,vehz);
    new carid = CreateVehicle(vehid,vehx,vehy,vehz,3,cc1,cc2,-1);
    SetVehicleNumberPlate(carid,"~>Admin<~");
    PutPlayerInVehicle(playerid, carid, 0);
    format(string,sizeof(string),"[AdmCmd] Du hast ein Admincar gespawnt! (FahrzeugID :%d)",GetVehicleModel(GetPlayerVehicleID(playerid)));
    SendClientMessage(playerid,ROT,string);
    }
    else
    {
    SendClientMessage(playerid,ROT,"Zugriff verweigert.Benötigter Rang: {FF0023}FullAdmin");
    }
    return 1;
    }

    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint:


  • if (strcmp("/veh", cmdtext, true, 10) == 0)
    {
    if(!strlen(strget(cmdtext,3))) return SendClientMessage(playerid, ROT,"Benutze /veh [VEHICLE] [COLOR1] [COLOR2]");


    {
    new col1, col2, car;
    new medelid = GetPlayerVehicleID(playerid);
    new Float:X, Float:Y, Float:Z, Float:A;


    GetPlayerPos(playerid, X, Y, X);
    GetPlayerFacingAngle(playerid,A);


    modelid = strval(strget(cmdtext,1));
    col1 = strval(strget(cmdtext,2));
    cal2 = strval(strget(cmdtext,3));


    car = AddStaticVehicle(modelid,X, Y, Z, col1, col2);


    PutPlayerInVehicle(playerid,car,0);
    }
    }
    return 0;
    }


    versuch mal das ich habe es net getestet habe es nur aus dem Kopf geschrieben xD

    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint:


  • Danke erstmal.



    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(323) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(324) : warning 217: loose indentation
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(332) : error 017: undefined symbol "modelid"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(332) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(333) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(334) : error 017: undefined symbol "cal2"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(334) : error 017: undefined symbol "strget"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(336) : error 017: undefined symbol "modelid"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(326) : warning 204: symbol is assigned a value that is never used: "medelid"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    7 Errors.


    Hier kommen die Errors.

  • if (strcmp("/veh", cmdtext, true, 10) == 0)
    {
    if(!strlen(strget(cmdtext,3))) return SendClientMessage(playerid, ROT,"Benutze /veh [VEHICLE] [COLOR1] [COLOR2]");
    {
    new col1, col2, car;
    new medelid = GetPlayerVehicleID(playerid);
    new Float:X, Float:Y, Float:Z, Float:A;


    GetPlayerPos(playerid, X, Y, X);
    GetPlayerFacingAngle(playerid,A);


    modelid = strval(strget(cmdtext,1));
    col1 = strval(strget(cmdtext,2));
    cal2 = strval(strget(cmdtext,3));


    car = AddStaticVehicle(modelid,X, Y, Z, col1, col2);
    PutPlayerInVehicle(playerid,car,0);
    }
    }
    return 0;
    }


  • if (!strcmp("/veh", cmdtext, true))
    {
    if(!strlen(strget(cmdtext,3))) return SendClientMessage(playerid, ROT,"Benutze /veh [VEHICLE] [COLOR1] [COLOR2]");
    new col1, col2, car;
    new modelid = GetPlayerVehicleID(playerid);
    new Float:X, Float:Y, Float:Z, Float:A;


    GetPlayerPos(playerid, X, Y, X);
    GetPlayerFacingAngle(playerid,A);


    modelid = strval(strget(cmdtext,1));
    col1 = strval(strget(cmdtext,2));
    col2 = strval(strget(cmdtext,3));


    car = AddStaticVehicle(modelid,X, Y, Z, col1, col2,-1);


    PutPlayerInVehicle(playerid,car,0);
    return 1;
    }



    stock strget(strx[], pos, search = ' ') {
    new arg, ret[128], idxx;
    for (new i = 0; i < strlen(strx); i++) {
    if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
    arg++;
    if (arg == pos + 1){
    ret[i-idxx] = EOS;
    return ret;
    } else if (arg == pos)
    idxx= i+1;
    }
    else if (arg == pos)
    ret[i - idxx] = strx[i];
    }
    return ret;
    }

  • Danke erstmal,


    warum muss man den jetzt ein stock verwenden ? Könntest du mir das bitte auch mal erklären.
    Und ich bekomme 1Error,



    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(340) : warning 209: function "OnPlayerCommandText" should return a value
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(341) : error 010: invalid function or declaration
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Error.

  • OK.


    Ich geb dir jetz mal mein Code


    ocmd:veh(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid,4))return SendClientMessage(playerid,Admin,"Dein Rang ist zu niedrig!");
    {
    new Float:x, Float:y, Float:z;
    new c1,c2,vid;
    if(sscanf(params,"iii",vid,c1,c2))return SendClientMessage(playerid,Admin,"/veh [id] [color1][color2]");
    {
    if(vid<402||vid>603)return SendClientMessage(playerid,Admin,"ID 402-603");
    {
    GetPlayerPos(playerid,x,y,z);
    new car;
    SetVehicleNumberPlate(car = CreateVehicle(vid,x,y,z,3,c1,c2,-1),"Admin");
    PutPlayerInVehicle(playerid,car,0);
    SendClientMessage(playerid,Admin,"Du hast dein Auto gespawnt.");
    return 1;
    }
    }
    }
    }


    Eventuell musst du deine Adminabfrage ändern.

  • ocmd:veh(playerid,params[])
    {
    new Float:x, Float:y, Float:z;
    new c1,c2,vid;
    if(sscanf(params,"iii",vid,c1,c2))return SendClientMessage(playerid,Admin,"/veh [id] [color1][color2]");
    {
    if(vid<402||vid>603)return SendClientMessage(playerid,Admin,"ID 402-603");
    {
    GetPlayerPos(playerid,x,y,z);
    new car;
    SetVehicleNumberPlate(car = CreateVehicle(vid,x,y,z,3,c1,c2,-1),"Admin");
    PutPlayerInVehicle(playerid,car,0);
    SendClientMessage(playerid,Admin,"Du hast dein Auto gespawnt.");
    return 1;
    }
    }
    }


    Bütteschön, ohne Adminabfrage

  • Genau so habe ich es eingebaut, doch wieder Errors.



    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : error 017: undefined symbol "sscanf"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(327) : error 017: undefined symbol "Admin"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(329) : error 017: undefined symbol "Admin"
    C:\Users\Findik\Desktop\Selfmade\pawno\Selfmade.pwn(335) : error 017: undefined symbol "Admin"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.