Suche simples Wanted 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
  • ok wie kann ich z.b machen das ich die id des spieler eingeben muss weil bei playerid bekomm ich ja dann selber das wanted ;D
    also mit SetPlayerWantedLevelwird ja das Wanted lvl gesetet

  • !UNGETESTET!


    ocmd:givewanteds(playerid,params[])
    {
    if(IsPlayerInFraktion(playerid,3))//Abfrage der Fraktion | ggf. anpassen!
    {
    new pID; //playerid die die Wanteds bekommt!
    new wanteds; //Wanteds
    new grund[256]; //Der Grund
    new aktuellewanteds=GetPlayerWantedLevel(pID); //Berechnet die aktuellen Wanteds
    new string[256]; //Der String, der an den Spieler ausgegeben wird!
    if(sscanf(params,"uis",pID,wanteds,grund))return SendClientMessage(playerid,Rot,"Fehler: /givewanteds [ID/Name] [Anzahl] [Grund]");
    {
    format(string,sizeof(string),"Du hast von Polizist %s %i Wanteds bekommen , Grund: %s", PlayerName(playerid),wanteds,grund);
    SendClientMessage(pID,Gelb,string);
    SetPlayerWantedLevel(pID,aktuellewanteds+wanteds);


    }
    }
    return 1;
    }


    Dir fehlt warscheinlich dann noch PlayerName(playerid);


    stock PlayerName(playerid)
    {
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
    }

  • [LR]Chupa's Wanted System aus dem Showroom
    Probier den mal aus..



    #include <a_samp>
    #include <SII>
    #include <dini>


    #pragma unused ret_memcpy


    #define TDSET 1888


    new WantedArt;
    new WantedOn;


    new Text:Wanteds[MAX_PLAYERS];


    forward WantedUpdate(playerid);
    forward WantedSternUpdate(playerid);


    public OnFilterScriptInit()
    {
    LoadSet();


    print("\n--------------------------------------");
    print(" WantedTextdraw by [LR]Chupa");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    SaveSet();
    return 1;
    }


    public OnPlayerConnect(playerid)
    {


    Wanteds[playerid] = TextDrawCreate(470,105,"~n~ Wanteds: -- ~n~");
    TextDrawFont(Wanteds[playerid],2);
    TextDrawColor(Wanteds[playerid],0xFFFF00AA);
    TextDrawLetterSize(Wanteds[playerid],0.599999,1.000000);
    TextDrawSetOutline(Wanteds[playerid],1);
    TextDrawSetShadow(Wanteds[playerid],1);
    TextDrawSetProportional(Wanteds[playerid],1);
    TextDrawBackgroundColor(Wanteds[playerid],0x000000ff);
    TextDrawUseBox(Wanteds[playerid], 1);
    TextDrawBoxColor(Wanteds[playerid], 0x000000FF);


    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    TextDrawHideForPlayer(playerid,Wanteds[playerid]);
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    if(WantedOn == 1)
    {
    TextDrawShowForPlayer(playerid,Wanteds[playerid]);
    switch(WantedArt)
    {
    case 0:
    {
    WantedSternUpdate(playerid);
    SetTimerEx("WantedSternUpdate",30000,1,"i",playerid);
    }
    case 1:
    {
    WantedUpdate(playerid);
    SetTimerEx("WantedUpdate",30000,1,"i",playerid);
    }
    }
    }
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(cmdtext,"/wtd",true)==0)
    {
    if(IsPlayerAdmin(playerid))
    {
    ShowPlayerDialog(playerid,TDSET,DIALOG_STYLE_LIST,"Einstellungen"," Wanted-Text Anzeigen\n Wanted-Text nicht Anzeigen\n Wanteds als Sterne\n Wanteds als Nummern","Okay","Abbruch");
    }
    else
    {
    SendClientMessage(playerid,0xFFFF00AA,"Du bist nicht dazu Berechtigt!");
    }
    return 1;
    }
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    switch(dialogid)
    {
    case TDSET:
    {
    switch(response)
    {
    case 1:
    {
    switch(listitem)
    {
    case 0:
    {
    WantedOn = 1;
    SendClientMessage(playerid,0xFFFF00AA,"Wanted - Text wird angezeigt!");
    ShowWanteds();
    }
    case 1:
    {
    SendClientMessage(playerid,0xFFFF00AA,"Wanted - Text Ausgestellt!");
    WantedOn = 0;
    HideWanteds();
    }
    case 2:
    {
    WantedArt = 0;
    WantedSternUmstell();
    SendClientMessage(playerid,0xFFFF00AA,"Wanteds werden als Sterne Angezeigt!");
    }
    case 3:
    {
    WantedArt = 1;
    WantedUmstell();
    SendClientMessage(playerid,0xFFFF00AA,"Wanteds werden als Nummern angezeigt!");
    }
    }
    }
    case 0:
    {
    SendClientMessage(playerid,0xFFFF00AA,"Abgebrochen");
    }
    }
    }
    }
    return 1;
    }


    public WantedUpdate(playerid)
    {
    if(WantedOn == 1)
    {
    new Wntd = GetPlayerWantedLevel(playerid);
    new string[56];
    format(string,56,"~n~ Wanteds: %d ~n~",Wntd);
    TextDrawHideForPlayer(playerid,Wanteds[playerid]);
    TextDrawSetString(Wanteds[playerid],string);
    return TextDrawShowForPlayer(playerid,Wanteds[playerid]);
    }
    else
    {


    }
    }


    public WantedSternUpdate(playerid)
    {
    if(WantedOn == 1)
    {
    new Wntd = GetPlayerWantedLevel(playerid);
    new string[56];
    switch(Wntd)
    {
    case 0:
    {
    format(string,56,"~n~ Keine Wanteds ~n~");
    }
    case 1:
    {
    format(string,56,"~n~ ~w~] ~n~");
    }
    case 2:
    {
    format(string,56,"~n~ ~w~]] ~n~");
    }
    case 3:
    {
    format(string,56,"~n~ ~w~]]] ~n~");
    }
    case 4:
    {
    format(string,56,"~n~ ]]]] ~n~");
    }
    case 5:
    {
    format(string,56,"~n~ ]]]]] ~n~");
    }
    case 6:
    {
    format(string,56,"~n~ ~r~]]]]]] ~n~");
    }
    }
    TextDrawHideForPlayer(playerid,Wanteds[playerid]);
    TextDrawSetString(Wanteds[playerid],string);
    return TextDrawShowForPlayer(playerid,Wanteds[playerid]);
    }
    else
    {


    }
    }


    stock WantedSternUmstell()
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    WantedSternUpdate(i);
    }
    }


    stock WantedUmstell()
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    WantedUpdate(i);
    }
    }


    stock HideWanteds()
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    TextDrawHideForPlayer(i,Wanteds[i]);
    }
    return 1;
    }


    stock ShowWanteds()
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    TextDrawShowForPlayer(i,Wanteds[i]);
    }
    return 1;
    }


    stock LoadSet()
    {
    new file[128];
    format(file,128,"WantedSettings.ini");


    if(fexist(file))
    {
    if(INI_Open(file))
    {
    WantedOn = INI_ReadInt("WantedAn");
    WantedArt = INI_ReadInt("WantedArt");
    INI_Close();
    }
    }
    else
    {
    dini_Create(file);
    }


    if(WantedOn == 1)
    {
    ShowWanteds();
    }
    else
    {
    HideWanteds();
    }
    return 1;
    }


    stock SaveSet()
    {
    new file[128];
    format(file,128,"WantedSettings.ini");


    if(fexist(file))
    {
    if(INI_Open(file))
    {
    INI_WriteInt("WantedsAn",WantedOn);
    INI_WriteInt("WantedArt",WantedArt);
    INI_Save();
    INI_Close();
    }
    }
    else
    {
    dini_Create(file);
    }
    return 1;
    }