Admin Pickup System

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 wieso funktioniert mein Adminpickup befehl nicht ?


    ocmd:adminpickup(playerid,params[])
    {
    new art[30];
    if(sscanf(params,"s",art)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(art,"Waffe",true)==0)
    {
    new waffe[50],muni,string[50];
    if(sscanf(params,"ssd",art,waffe,muni)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup Waffe [Waffe] [Munnition]");
    if(strcmp(waffe,"Deagle",true)==0)
    {
    format(string,sizeof(string),"%s %d",waffe,muni);
    SendClientMessage(playerid,ROT,string);
    }
    else if(strcmp(waffe,"mp5",true)==0)
    {
    format(string,sizeof(string),"%s %d ",waffe,muni);
    SendClientMessage(playerid,ROT,string);
    }
    }
    return 1;
    }


    außerdem bekomme ich immer das hier
    [09/08/2015 18:26:33] sscanf warning: Strings without a length are deprecated, please add a destination size.
    [09/08/2015 18:26:33] sscanf warning: Strings without a length are deprecated, please add a destination size.
    [09/08/2015 18:26:35] sscanf warning: Strings without a length are deprecated, please add a destination size.

  • ocmd:adminpickup(playerid,params[])
    {
    if(!params[0]) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(params,"Waffe ",true,6)==0)
    {
    new art,waffe[50],muni,string[50];
    if(sscanf(params,"s[30]s[50]d",art,waffe,muni)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup Waffe [Waffe] [Munnition]");
    if(strcmp(waffe,"Deagle",true)==0)
    {
    format(string,sizeof(string),"%s %d",waffe,muni);
    SendClientMessage(playerid,ROT,string);
    }
    else if(strcmp(waffe,"mp5",true)==0)
    {
    format(string,sizeof(string),"%s %d ",waffe,muni);
    SendClientMessage(playerid,ROT,string);
    }
    }
    return 1;
    }

  • Ohne Parameter?
    Versuche es so:
    ocmd:adminpickup(playerid,params[])
    {
    if(strlen(params) < 2) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(params,"Waffe ",true,6)==0)
    {
    new art[30],waffe[50],muni,string[50];
    if(sscanf(params,"s[30]s[50]d",art,waffe,muni)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup Waffe [Waffe] [Munnition]");
    if(strcmp(waffe,"Deagle",true)==0)
    {
    format(string,sizeof(string),"%s %d",waffe,muni);
    return SendClientMessage(playerid,ROT,string);
    }
    else if(strcmp(waffe,"mp5",true)==0)
    {
    format(string,sizeof(string),"%s %d ",waffe,muni);
    return SendClientMessage(playerid,ROT,string);
    }
    }
    return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    }

    3HZXdYd.png

    Einmal editiert, zuletzt von Jeffry ()

  • ocmd:adminpickup(playerid,params[])
    {
    new waffe[50];
    new art[30];
    new muni;
    if(sscanf(params,"s[30]s[50]d",art,waffe,muni)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup Waffe [Waffe] [Munnition]");
    if(strcmp(art,"Waffe ",true,6)==0)
    {
    if(strcmp(waffe,"Deagle",true)==0)
    {
    SendClientMessage(playerid,ROT,"deagle...");
    }
    else if(strcmp(waffe,"mp5",true)==0)
    {
    SendClientMessage(playerid,ROT,"mp5, btw bin ich zu unfähig etwas selbst zu tun :D:D:D");
    }
    else{
    SendClientMessage(playerid, ROT, "Invalider Waffentyp");
    }
    }
    return 1;
    }

    Einmal editiert, zuletzt von alva ()

  • Hast du eine mehrzeilige Meldung mit vielen Zahlen im Compiler?


    Versuche es gegebenenfalls mal so, um etwas weniger Variablen zu nutzen:
    ocmd:adminpickup(playerid,params[])
    {
    if(strlen(params) < 2) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(params,"Waffe ",true,6)==0)
    {
    new art[16],str[16],muni;
    if(sscanf(params,"s[16]s[16]d",art,str,muni)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup Waffe [Waffe] [Munnition]");
    if(strcmp(str,"Deagle",true)==0)
    {
    //Deagle geben
    }
    else if(strcmp(str,"mp5",true)==0)
    {
    //MP5 Geben
    }
    else
    {
    return SendClientMessage(playerid,ROT,"Invalid.");
    }
    format(str,sizeof(str),"%s %d",str,muni);
    return SendClientMessage(playerid,ROT,str);
    }
    return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    }

  • habe es jetze so gemacht es funktioniert auch
    aber ich stehe gerade richtig aufm Schlauch


    ich will bei OnPlayerPickUpPickup abfragen welchen Typ der hat das weiß ich aber ich will die auch später löschen aber weiß gerade garnicht wie ich das machen soll


    Mein Enum
    enum Apickupssystem
    {
    a_typ,
    Float:a_px,
    Float:a_py,
    Float:a_pz,
    ap_id
    }


    ocmd:adminpickup(playerid,params[])
    {
    new art[30],Float:ppx,Float:ppy,Float:ppz;
    if(sscanf(params,"s[30]",art)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(art,"Deagle",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    CreatePickup(348,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"mp5",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    CreatePickup(353,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    return 1;
    }

  • new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, 0xFF0000FF, "Error: Alle voll.");
    aPickups[id][e_pickupid] = CreatePickup(...);


    Bei OnGameModeInit setzt du alle e_pickupid auf -1, mit einer Schleife.


    Und bei GetFreePickupID machst du eine Schleife durch alle aPickups und fragst ab, ob es -1 ist, wenn ja returnst du i. Wird keins gefunden, nach der Schleife, -1.
    Gleich bei OnPlayerPickUpPickup, nur eben nicht auf -1 prüfen, sondern auf pickupid.


    Versuche das mal anhand der Beschreibung hinzubekommen.

  • new ap_id[5] = {-1,...};


    Unten im Code:
    stock GetFreePickupID()
    {
    for(new i=0; i<sizeof(ap_id); i++) if(ap_id[i] == -1) return i;
    return -1;
    }


    Und im Command:
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, 0xFF0000FF, "Error: Alle voll.");
    ap_id[id] = CreatePickup(/*...*/);

  • ok soweit so gut aber ich komme unter OnPlayerPickupPickup nicht weiter


    ocmd:adminpickup(playerid,params[])
    {
    new art[30],Float:ppx,Float:ppy,Float:ppz;
    if(sscanf(params,"s[30]",art)) return SendClientMessage(playerid,ROT,"Benutze: {D6D6D6}/adminpickup [Art]");
    if(strcmp(art,"Deagle",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 348;
    ap_id[id] = CreatePickup(348,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"mp5",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 353;
    ap_id[id] = CreatePickup(353,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"messer",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 335;
    ap_id[id] = CreatePickup(335,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"9mm",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 346;
    ap_id[id] = CreatePickup(346,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Silencer",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 347;
    ap_id[id] = CreatePickup(347,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Shotgun",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 349;
    ap_id[id] = CreatePickup(349,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"m4",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 356;
    ap_id[id] = CreatePickup(356,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"ak47",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 355;
    ap_id[id] = CreatePickup(355,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Sniper",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 358;
    ap_id[id] = CreatePickup(358,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Rifle",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 357;
    ap_id[id] = CreatePickup(357,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Health",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 1240;
    ap_id[id] = CreatePickup(1240,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    else if(strcmp(art,"Armour",true)==0)
    {
    GetPlayerPos(playerid,ppx,ppy,ppz);
    new id = GetFreePickupID();
    if(id == -1) return SendClientMessage(playerid, ROT, "Es könnenn keine Adminpickups mehr erstellt werden.");
    Apickup[id][a_px] = ppx;
    Apickup[id][a_py] = ppy;
    Apickup[id][a_pz] = ppz;
    Apickup[id][a_typ] = 1242;
    ap_id[id] = CreatePickup(1242,0,ppx,ppy,ppz,GetPlayerVirtualWorld(playerid));
    return 1;
    }
    return 1;
    }



    es wird nichts geprintet ?



    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    printf("aufruf");
    for(new i=0; i<sizeof(ap_id); i++)
    {
    printf("sizeof");
    if(pickupid == ap_id[i])
    {
    printf("pickupdid");
    SendClientMessage(playerid,ROT,"Aufgerufen!");
    if(Apickup[i][a_typ] == 1242)
    {
    SetPlayerArmour(playerid,100);
    SendClientMessage(playerid,ROT,"Armour!");
    }
    }
    }
    return 1;
    }

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen