Kopfgeld

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
  • hi


    könnte mir einer machen das bei dem Script das Geld
    immer zu dem Kopfgeld dazu gezählt wird?


    jetzt ist es so, wenn einer z.B. 10$ Kopfgeld setzt, wenn dann
    noch einer auf den selben 12$ setzt ist das kopfgeld 12$ und nicht 22$.

    #include <a_samp>



    #define filterscript
    #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1



    /* ----------EDIT FROM HERE----------*/
    #define COLOR_FOUND 0xFFFF00AA //Color of the message if a hit was found in /hits
    #define COLOR_MSG 0x00FFFFFF //Color of general messages
    #define COLOR_ERROR 0xFF0000FF //Color of the message if there was an error
    #define ANTISPAM_TIME 5 //The minimum time between /hit commands to prevent spam (in seconds)
    /*----------NO NEED TO EDIT FROM HERE----------*/



    new hit[MAX_PLAYERS];
    new hiter[MAX_PLAYERS];
    new ID;
    new antispam[MAX_PLAYERS];



    stock sscanf(string[], format[], {Float,_}:...)
    {
    new
    formatPos = 0,
    stringPos = 0,
    paramPos = 2,
    paramCount = numargs();
    while (paramPos < paramCount && string[stringPos])
    {
    switch (format[formatPos++])
    {
    case '\0':
    {
    return 0;
    }
    case 'i', 'd':
    {
    new
    neg = 1,
    num = 0,
    ch = string[stringPos];
    if (ch == '-')
    {
    neg = -1;
    ch = string[++stringPos];
    }
    do
    {
    stringPos++;
    if (ch >= '0' && ch <= '9')
    {
    num = (num * 10) + (ch - '0');
    }
    else
    {
    return 1;
    }
    }
    while ((ch = string[stringPos]) && ch != ' ');
    setarg(paramPos, 0, num * neg);
    }
    case 'h', 'x':
    {
    new
    ch,
    num = 0;
    while ((ch = string[stringPos++]))
    {
    switch (ch)
    {
    case 'x', 'X':
    {
    num = 0;
    continue;
    }
    case '0' .. '9':
    {
    num = (num << 4) | (ch - '0');
    }
    case 'a' .. 'f':
    {
    num = (num << 4) | (ch - ('a' - 10));
    }
    case 'A' .. 'F':
    {
    num = (num << 4) | (ch - ('A' - 10));
    }
    case ' ':
    {
    break;
    }
    default:
    {
    return 1;
    }
    }
    }
    setarg(paramPos, 0, num);
    }
    case 'c':
    {
    setarg(paramPos, 0, string[stringPos++]);
    }
    case 'f':
    {
    new tmp[25];
    strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
    setarg(paramPos, 0, _:floatstr(tmp));
    }
    case 's', 'z':
    {
    new
    i = 0,
    ch;
    if (format[formatPos])
    {
    while ((ch = string[stringPos++]) && ch != ' ')
    {
    setarg(paramPos, i++, ch);
    }
    if (!i) return 1;
    }
    else
    {
    while ((ch = string[stringPos++]))
    {
    setarg(paramPos, i++, ch);
    }
    }
    stringPos--;
    setarg(paramPos, i, '\0');
    }
    default:
    {
    continue;
    }
    }
    while (string[stringPos] && string[stringPos] != ' ')
    {
    stringPos++;
    }
    while (string[stringPos] == ' ')
    {
    stringPos++;
    }
    paramPos++;
    }
    while (format[formatPos] == 'z') formatPos++;
    return format[formatPos];
    }


    stock ReturnPlayerName(id)
    {
    new tehname[MAX_PLAYER_NAME];
    GetPlayerName(id, tehname, sizeof(tehname));
    return tehname;
    }



    dcmd_hit(playerid, params[])
    {
    new amount;
    if(sscanf(params, "dd", ID, amount))
    {
    SendClientMessage(playerid, COLOR_ERROR, "Fehler: /hitman [id] [summe]");
    }
    else if(amount > 0)
    {
    if(IsPlayerConnected(ID))
    {
    if(GetPlayerMoney(playerid) >= amount)
    {
    if(antispam[playerid] == 0)
    {
    hit[ID] = amount;
    hiter[ID] = playerid;
    new string[256];
    GivePlayerMoney(playerid, -amount);
    format(string, sizeof(string), "%s hat ein Kopfgeld $%i für den Tod von %s (%i) ausgesetzt. ", ReturnPlayerName(playerid), amount ,ReturnPlayerName(ID), ID);
    SendClientMessageToAll(COLOR_MSG, string);
    antispam[playerid] = 1;
    SetTimerEx("antispamtimer", ANTISPAM_TIME*1000, false, "d", playerid);
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERROR, "Warte kurz bevor du wieder Kopfgeld ausetzten kannst!");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERROR, "Du hast nich so viel Geld!");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERROR, "Der Player ist nicht online!");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERROR, "Minimum Summe ist $1!");
    }
    return 1;
    }



    public OnPlayerCommandText(playerid, cmdtext[])
    {
    dcmd(hit, 3, cmdtext);


    if(!strcmp(cmdtext, "/kopfgeld", true))
    {
    new count = 0;
    SendClientMessage(playerid, COLOR_MSG, "Kopfgeld:");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && hit[i] > 0)
    {
    new string[256];
    format(string, 256, "%s (%i) for $%i", ReturnPlayerName(i), i, hit[i]);
    SendClientMessage(playerid, COLOR_FOUND, string);
    count++;
    }
    }
    if(count == 1)
    {
    SendClientMessage(playerid, COLOR_ERROR, "Es gibt kein Kopfgeld!");
    }
    }
    return 0;
    }



    public OnPlayerDeath(playerid, killerid, reason)
    {
    if(reason <= 46 && hit[playerid] != 0)
    {
    new string[256];
    format(string, sizeof(string), "Du hast %s (%i) gekillt dafür bekommst du $%i", ReturnPlayerName(playerid), playerid, hit[playerid]);
    SendClientMessage(killerid,COLOR_MSG, string);
    GivePlayerMoney(killerid, hit[playerid]);
    hit[playerid] = 0;
    }
    else if(hit[playerid] != 0)
    {
    new string[256];
    format(string, sizeof(string), "The hit on %s (%i) has been cancelled (died)", ReturnPlayerName(playerid), playerid);
    SendClientMessageToAll(COLOR_MSG, string);
    hit[playerid] = 0;
    }
    return 1;
    }



    public OnPlayerDisconnect(playerid)
    {
    if(hit[playerid] > 0)
    {
    new string[256];
    format(string, sizeof(string), "The hit on %s (%i) has been cancelled (disconnected)", ReturnPlayerName(playerid), playerid);
    SendClientMessageToAll(COLOR_MSG, string);
    hit[playerid] = 0;
    }
    return 1;
    }


    forward antispamtimer(id);


    public antispamtimer(id)
    {
    antispam[id] = 0;
    }


    kann mir bitte einer helfen


    mfg Halo