Wanted System mit Textdraws problem

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
  • Fehler:
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5743) : error 035: argument type mismatch (argument 3)
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5741) : warning 203: symbol is never used: "wantedlevel"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Error.



    stock SetWantedLevel(playerid,wantedlevel)
    {
    mysql_SetInt(Tabelle_Spieler, "Wanteds","%d",wantedlevel, "Name",GetName(pID));
    UpdateWantedDraw(playerid);
    return 1;
    }
    Alles vom Wantedsystem:
    forward WantedTimerPublic(playerid);
    public WantedTimerPublic(playerid)
    {
    if(GetWantedLevel(playerid)>=1)
    {
    SetWantedLevel(playerid,GetWantedLevel(playerid)-1);
    new str[200];
    format(str,sizeof(str),"Du hast ein Wantedlevel verloren. Aktuelles Wantedlevel: %i", GetWantedLevel(playerid));
    SendClientMessage(playerid, Rot, str);
    return 1;
    }return 1;
    }
    stock GetWantedLevel(playerid)
    {
    return GetPVarInt(playerid,"Wantedlevel");
    }
    stock SetWantedLevel(playerid,wantedlevel)
    {
    mysql_SetInt(Tabelle_Spieler, "Wanteds","%d",wantedlevel, "Name",GetName(pID));
    UpdateWantedDraw(playerid);
    return 1;
    }
    stock UpdateWantedDraw(playerid)
    {
    if(GetWantedLevel(playerid)>=1)
    {
    TextDrawHideForPlayer(playerid, Text:WantedTextdraw[playerid]);
    new str[30];
    format(str,sizeof(str),"%d",GetWantedLevel(playerid));
    TextDrawSetString(Text:WantedTextdraw[playerid], str);
    TextDrawShowForPlayer(playerid, Text:WantedTextdraw[playerid]);
    }
    return 1;
    }


    ocmd:wanted(playerid,params[])
    {
    new str[128], pID, wantedlevel;
    if(sscanf(params, "ui", pID, wantedlevel))return SendClientMessage(playerid, Rot, "Benutze: /wanted [ID] [Wanteds]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(str,sizeof(str),"Du gibst %s [ID: %i] %i Wanted(s).", GetName(pID), pID, wantedlevel);
    SendClientMessage(playerid, Rot, str);
    SetWantedLevel(pID,GetWantedLevel(pID)+wantedlevel);
    format(str,sizeof(str),"Du erhälst %i Wanted(s) von der Polizei. Aktuelles Wantedlevel: %i", wantedlevel, GetWantedLevel(playerid));
    SendClientMessage(pID, Rot, str);
    return 1;
    }else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }


    ocmd:wantedlist(playerid,params[])
    {
    new string[64];
    SendClientMessage(playerid, Rot,"-----Wanted - Liste-----");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(!IsPlayerNPC(i))
    {
    if(GetWantedLevel(i) >=1)
    {
    format(string, sizeof(string), "%s - Wanteds: %d", GetName(i), GetWantedLevel(i));
    SendClientMessage(playerid, Rot,string);
    }
    }
    }
    }
    return 1;
    }


    ocmd:clearwanted(playerid,params[])
    {
    new str[128], pID;
    if(sscanf(params, "u", pID))return SendClientMessage(playerid, Rot, "Benutze: /clearwanted [ID]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(str,sizeof(str),"Du clearst die Wanteds von %s [ID: %i].", GetName(pID), pID);
    SendClientMessage(playerid, Rot, str);
    SendClientMessage(pID, Rot, "Deine Wanteds wurden von der Polizei gecleart.");
    SetWantedLevel(pID,0);
    return 1;
    }else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }

  • Ok das funktioniert jetzt,aber wenn ich Wanteds gebe,dann kommt der Textdraw nicht,habe auch keine Errors oderso die Zeilen sind hier.
    stock UpdateWantedDraw(playerid)
    {
    if(GetWantedLevel(playerid)>=1)
    {
    TextDrawHideForPlayer(playerid, Text:WantedTextdraw[playerid]);
    new str[30];
    format(str,sizeof(str),"%d",GetWantedLevel(playerid));
    TextDrawSetString(Text:WantedTextdraw[playerid], str);
    TextDrawShowForPlayer(playerid, Text:WantedTextdraw[playerid]);
    }
    return 1;
    }


    forward WantedTimerPublic(playerid);
    public WantedTimerPublic(playerid)
    {
    if(GetWantedLevel(playerid)>=1)
    {
    SetWantedLevel(playerid,GetWantedLevel(playerid)-1);
    new str[200];
    format(str,sizeof(str),"Du hast ein Wantedlevel verloren. Aktuelles Wantedlevel: %i", GetWantedLevel(playerid));
    SendClientMessage(playerid, Rot, str);
    return 1;
    }return 1;
    }
    ocmd:wanted(playerid,params[])
    {
    new str[128], pID, wantedlevel;
    if(sscanf(params, "ui", pID, wantedlevel))return SendClientMessage(playerid, Rot, "Benutze: /wanted [ID] [Wanteds]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(str,sizeof(str),"Du gibst %s [ID: %i] %i Wanted(s).", GetName(pID), pID, wantedlevel);
    SendClientMessage(playerid, Rot, str);
    SetWantedLevel(pID,GetWantedLevel(pID)+wantedlevel);
    format(str,sizeof(str),"Du erhälst %i Wanted(s) von der Polizei. Aktuelles Wantedlevel: %i", wantedlevel, GetWantedLevel(playerid));
    SendClientMessage(pID, Rot, str);
    return 1;
    }else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }


    WantedTextdraw[playerid] = CreatePlayerTextDraw(playerid, 602.399963, 111.253318, "69");
    PlayerTextDrawLetterSize(playerid, WantedTextdraw[playerid], 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawColor(playerid, WantedTextdraw[playerid], -2147483393);
    PlayerTextDrawSetShadow(playerid, WantedTextdraw[playerid], 0);
    PlayerTextDrawSetOutline(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, WantedTextdraw[playerid], 51);
    PlayerTextDrawFont(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawSetProportional(playerid, WantedTextdraw[playerid], 1);

    Einmal editiert, zuletzt von [PeL]Smiley ()

  • Füg das so ein und schik mal deine Serverlog.



    forward UpdateWantedDraw(playerid);
    public UpdateWantedDraw(playerid)//Der Stock muss ein public sein, falls es mit einen Timer benutzt wird.
    {
    if(GetWantedLevel(playerid)>=1)
    {
    TextDrawHideForPlayer(playerid, Text:WantedTextdraw[playerid]);
    new str[30];
    format(str,sizeof(str),"%d",GetWantedLevel(playerid));
    TextDrawSetString(Text:WantedTextdraw[playerid], str);
    TextDrawShowForPlayer(playerid, Text:WantedTextdraw[playerid]);
    }
    return 1;
    }



    ocmd:wanted(playerid,params[])
    {
    new str[128], pID, wantedlevel;
    if(sscanf(params, "id", pID, wantedlevel))return SendClientMessage(playerid, Rot, "Benutze: /wanted [ID] [Wanteds]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    printf("%s",GetWantedLevel(pID));
    format(str,sizeof(str),"Du gibst %s [ID: %i] %d Wanted(s).", GetName(pID), pID, wantedlevel);
    printf("%s",str);
    SendClientMessage(playerid, Rot, str);
    SetWantedLevel(pID,GetWantedLevel(pID)+wantedlevel);
    format(str,sizeof(str),"Du erhälst %i Wanted(s) von der Polizei. Aktuelles Wantedlevel: %i", wantedlevel, GetWantedLevel(playerid));
    SendClientMessage(pID, Rot, str);
    printf("%s",GetWantedLevel(pID));
    return 1;
    }else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }

  • Das steht dann in der Sever_Log:
    [13:15:30] Number of vehicle models: 0
    [13:15:54] Incoming connection: 127.0.0.1:59780
    [13:15:55] [join] Smiley has joined the server (0:127.0.0.1)
    [13:16:08]
    [13:16:08] Du gibst Smiley [ID: 0] 20 Wanted(s).
    [13:16:08] miley

  • Was ist jetzt hierdran falsch?
    ocmd:wanted(playerid,params[])
    {
    new string[128], pID, wantedlevel,reason[64];
    if(sscanf(params, "ids", pID, wantedlevel,reason))return SendClientMessage(playerid, Rot, "Benutze: /wanted [ID] [Wanteds] [Grund]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(string,sizeof(string),"<<Gesuchter:%s Wantedpunkte: %d Gesamt: %d Reporter: %s Grund:%s>>",GetName(pID),wantedlevel,wantedlevel(pID),GetName(playerid),reason);//Die Zeile
    SendClientMessageToAll(Rot,string);
    return 1;
    }else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }
    Fehler:
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5148) : error 012: invalid function call, not a valid address
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5148) : warning 215: expression has no effect
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5148) : error 001: expected token: ";", but found ")"
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5148) : error 029: invalid expression, assumed zero
    C:\Users\kevin\Desktop\server\gamemodes\self2.pwn(5148) : 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.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • stock SetWantedLevel(playerid,wantedlevel)
    {
    mysql_SetInt(Tabelle_Spieler, "Wanteds",wantedlevel, "Name",GetName(playerid));
    UpdateWantedDraw(playerid);
    return 1;
    }


    Schreib das mal so.


    Geht es dann?



    Es ist übrigens keine gute Idee es direkt über MySQL Abfragen zu machen. Eine Spielervariable wäre besser, die hin und wieder gespeichert wird.

  • Schreibs mal so (sind einige kleine Dinge geändert):

    Spoiler anzeigen
    new PlayerText:Wanted1[MAX_PLAYERS];
    new PlayerText:Wanted2[MAX_PLAYERS];
    new PlayerText:Wanted3[MAX_PLAYERS];
    new PlayerText:WantedTextdraw[MAX_PLAYERS];

    Spoiler anzeigen
    enum SpielerDaten
    {
    pRegDate[30],
    pRegistriert,
    pLevel,
    pGeld,
    pSkin,
    pAdminlevel,
    pLeader,
    pFraktion,
    pRang,
    pBan,
    pPerso,
    pTimeBan,
    pMute,
    pWarns,
    pReportAktiv,
    pWanteds
    };
    new SpielerInfo[MAX_PLAYERS][SpielerDaten];

    Spoiler anzeigen
    WantedTextdraw[playerid] = CreatePlayerTextDraw(playerid, 602.399963, 111.253318, "69");
    PlayerTextDrawLetterSize(playerid, WantedTextdraw[playerid], 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawColor(playerid, WantedTextdraw[playerid], -2147483393);
    PlayerTextDrawSetShadow(playerid, WantedTextdraw[playerid], 0);
    PlayerTextDrawSetOutline(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, WantedTextdraw[playerid], 51);
    PlayerTextDrawFont(playerid, WantedTextdraw[playerid], 1);
    PlayerTextDrawSetProportional(playerid, WantedTextdraw[playerid], 1);

    Spoiler anzeigen
    Wanted1[playerid] = CreatePlayerTextDraw(playerid, 612.000000, 109.013336, "[]");
    PlayerTextDrawLetterSize(playerid, Wanted1[playerid], -0.639599, 2.010663);
    PlayerTextDrawTextSize(playerid, Wanted1[playerid], 185.600036, 167.999954);
    PlayerTextDrawAlignment(playerid, Wanted1[playerid], 1);
    PlayerTextDrawColor(playerid, Wanted1[playerid], -5963521);
    PlayerTextDrawSetShadow(playerid, Wanted1[playerid], 0);
    PlayerTextDrawSetOutline(playerid, Wanted1[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, Wanted1[playerid], 51);
    PlayerTextDrawFont(playerid, Wanted1[playerid], 2);
    PlayerTextDrawSetProportional(playerid, Wanted1[playerid], 1);

    Spoiler anzeigen
    Wanted2[playerid] = CreatePlayerTextDraw(playerid, 573.999694, 106.779991, "usebox");
    PlayerTextDrawLetterSize(playerid, Wanted2[playerid], 0.000000, 2.305553);
    PlayerTextDrawTextSize(playerid, Wanted2[playerid], 677.199829, 0.000000);
    PlayerTextDrawAlignment(playerid, Wanted2[playerid], 1);
    PlayerTextDrawColor(playerid, Wanted2[playerid], 0);
    PlayerTextDrawUseBox(playerid, Wanted2[playerid], true);
    PlayerTextDrawBoxColor(playerid, Wanted2[playerid], 102);
    PlayerTextDrawSetShadow(playerid, Wanted2[playerid], 0);
    PlayerTextDrawSetOutline(playerid, Wanted2[playerid], 0);
    PlayerTextDrawFont(playerid, Wanted2[playerid], 0);

    Spoiler anzeigen
    Wanted3[playerid] = CreatePlayerTextDraw(playerid, 593.600036, 110.506675, ":");
    PlayerTextDrawLetterSize(playerid, Wanted3[playerid], 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid, Wanted3[playerid], 1);
    PlayerTextDrawColor(playerid, Wanted3[playerid], -1);
    PlayerTextDrawSetShadow(playerid, Wanted3[playerid], 0);
    PlayerTextDrawSetOutline(playerid, Wanted3[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, Wanted3[playerid], 51);
    PlayerTextDrawFont(playerid, Wanted3[playerid], 1);
    PlayerTextDrawSetProportional(playerid, Wanted3[playerid], 1);

    Spoiler anzeigen
    ocmd:wanted(playerid,params[])
    {
    new string[128], pID, wantedlevel,reason[64];
    if(sscanf(params, "ids", pID, wantedlevel,reason))return SendClientMessage(playerid, Rot, "Benutze: /wanted [ID] [Wanteds] [Grund]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(string,sizeof(string),"<<Gesuchter:%s Wantedpunkte: %d Gesamt: %d Reporter: %s Grund:%s>>",GetName(pID),wantedlevel,GetWantedLevel(pID),GetName(playerid),reason);
    SendClientMessageToAll(Rot,string);
    SetWantedLevel(pID,wantedlevel);
    UpdateWantedDraw(pID);
    return 1;
    }
    else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }
    else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }

    Spoiler anzeigen
    ocmd:wantedlist(playerid,params[])
    {
    new string[64];
    SendClientMessage(playerid, Rot,"-----Wanted - Liste-----");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(!IsPlayerNPC(i))
    {
    if(GetWantedLevel(i) >=1)
    {
    format(string, sizeof(string), "%s - Wanteds: %d", GetName(i), GetWantedLevel(i));
    SendClientMessage(playerid, Rot,string);
    }
    }
    }
    }
    return 1;
    }

    Spoiler anzeigen
    ocmd:clearwanted(playerid,params[])
    {
    new str[128], pID;
    if(sscanf(params, "u", pID))return SendClientMessage(playerid, Rot, "Benutze: /clearwanted [ID]");
    if(IsPlayerConnected(pID))
    {
    if(!IsPlayerNPC(pID))
    {
    format(str,sizeof(str),"Du clearst die Wanteds von %s [ID: %i].", GetName(pID), pID);
    SendClientMessage(playerid, Rot, str);
    SendClientMessage(pID, Rot, "Deine Wanteds wurden von der Polizei gecleart.");
    SetWantedLevel(pID,0);
    return 1;
    }
    else return SendClientMessage(playerid,Rot,"Du kannst einem NPC keine Wanteds geben.");
    }
    else return SendClientMessage(playerid,Rot,"Spieler ist nicht connected.");
    }

    Spoiler anzeigen
    forward UpdateWantedDraw(playerid);
    public UpdateWantedDraw(playerid)//Der Stock muss ein public sein, falls es mit einen Timer benutzt wird.
    {
    if(GetWantedLevel(playerid)>=1)
    {
    PlayerTextDrawHide(playerid, PlayerText:WantedTextdraw[playerid]);
    new str[30];
    format(str,sizeof(str),"%d",GetWantedLevel(playerid));
    PlayerTextDrawSetString(playerid, PlayerText:WantedTextdraw[playerid], str);
    PlayerTextDrawShow(playerid, PlayerText:WantedTextdraw[playerid]);
    PlayerTextDrawShow(playerid,PlayerText:Wanted1[playerid]);
    PlayerTextDrawShow(playerid,PlayerText:Wanted2[playerid]);
    PlayerTextDrawShow(playerid,PlayerText:Wanted3[playerid]);
    }
    else PlayerTextDrawHide(playerid, PlayerText:WantedTextdraw[playerid]);
    return 1;
    }
    stock GetWantedLevel(playerid)
    {
    return SpielerInfo[playerid][pWanteds];
    }
    stock SetWantedLevel(playerid,wantedlevel)
    {
    SpielerInfo[playerid][pWanteds] = wantedlevel;
    UpdateWantedDraw(playerid);
    return 1;
    }

    3HZXdYd.png

    Einmal editiert, zuletzt von Jeffry ()

  • Ok,das mit dem Textdraw klappt jetzt,allerdings,werden die Wanteds nicht dazu addiert. Sondern von 5 Auf 20 gesetzt wenn ich /wanted id 20 grund setze.
    Unteranderem das hier:

    Bei Gesamt: Sollte auch die gesamte Anzahl der Wanteds stehen.

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