Beiträge von xSpiderx

    Suche im Script nach "strtok" und Klammer es aus.


    In der Zeile 19643 Fehlt am Ende des Commands/Befehles ein ; (Semikolon oder so)


    Und stat new Returnuser Dashier ins Script setzen:


    IsNumeric(const string[])
    {
    for (new i = 0, j = strlen(string); i < j; i++)
    {
    if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
    }


    ReturnUser(text[], playerid = INVALID_PLAYER_ID)
    {
    new pos = 0;
    while (text[pos] < 0x21) // Strip out leading spaces
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos])) // Check whole passed string
    {
    // If they have a numeric name you have a problem (although names are checked on id failure)
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    /*if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "User not connected");
    }*/
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid; // A player was found
    }
    }
    /*else
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;*/
    // Removed for fallthrough code
    }
    // They entered [part of] a name or the id search failed (check names just incase)
    new len = strlen(text[pos]);
    new count = 0;
    new name[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, name, sizeof (name));
    if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
    {
    if (len == strlen(name)) // Exact match
    {
    return i; // Return the exact player on an exact match
    // Otherwise if there are two players:
    // Me and MeYou any time you entered Me it would find both
    // And never be able to return just Me's id
    }
    else // Partial match
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid; // INVALID_USER_ID for bad return
    }


    xSpiderx

    ???


    stock Register(playerid,key[])
    {
    new Spielerdatei[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Spielerdatei,sizeof(Spielerdatei,"/Accounts/%s.txt",name);
    dini_Create(Spielerdatei);
    dini_Set(Spielerdatei,"Passwort",key);
    SendClientMessage(playerid,0x0000FFFF,"Erfolgreich registriert, Viel Spass auf unserem Server!");
    return 1;
    }


    Und bei bei OnDialog so


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid==DIALOG_REGISTER)
    {
    if(response)
    {
    SendClientMessage(playerid,0x0000FFFF,"Du hast den Vorgang abgebrochen.");
    Kick(playerid);
    return 1;
    }
    if(!response);
    {
    if(!strlen(inputtext))
    {
    Register(playerid,inputtext);
    return 1;
    }
    }
    }
    return 1;
    }

    mach das so:
    format(tform,sizeof(tform),"auto_%d",i);
    if(djIsSet(F_DATEI,tform))
    {

    Emm ja du kannst echt super Gut Scripten ^^ Meister...
    Man kann sizeof auch ohne () schreiben.



    Zurück zum Thema:


    In den Zeilen steht ni-wo autos ^^


    Also kann es auch net sein das du DA einen Error bekommst.


    Falsche Zeilen ?


    xSpiderx

    Hiermal ein beispiel für einen /pay Befehel.


    So Schwer ist das doch net...


    dcmd_pay(playerid, params[])
    {
    new string[128];
    new pID;
    new menge;
    new Float:x, Float:y, Float:z;
    GetPlayerPos(pID, x, y, z);
    if(sscanf(params, "ii", pID, menge)) return SendClientMessage(playerid, COLOR_RED, "Benutze: /pay [id][menge]");
    if(menge > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_RED, "Du hast nicht so viel Geld auf der Hand!");
    if(!IsPlayerInRangeOfPlayer(6.00,playerid,pID)) return SendClientMessage(playerid, Falsch_Color, "Du bist nicht in der Nähe von diesem Spieler!");
    if(IsPlayerConnected(pID))
    {
    if(pID != INVALID_PLAYER_ID)
    {
    GivePlayerMoney(playerid, -menge);
    GivePlayerMoney(pID, menge);
    format(string, sizeof(string), " Du hast %s $%i gegeben", PlayerName(pID), menge);
    SendClientMessage(playerid, Info_Color, string);
    format(string, sizeof(string), " %s hat dir $%i gegeben", PlayerName(playerid), menge);
    SendClientMessage(pID,Orange_Color, string);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, Info_Color, "Du kannst dir nicht selber Geld geben!");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, Info_Color, "Dieser Spieler ist nicht Online!");
    return 1;
    }
    }


    xSpiderx


    //edit
    Den Code oben geändert und dashier dazu:


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


    //edit ²


    stock IsPlayerInRangeOfPlayer(Float:radi, playerid, targetid)
    {
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
    new Float:posx, Float:posy, Float:posz;
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    //radi = 2.0; //Trigger Radius
    GetPlayerPos(targetid, posx, posy, posz);
    tempposx = (oldposx -posx);
    tempposy = (oldposy -posy);
    tempposz = (oldposz -posz);
    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
    return 1;
    }
    }
    return 0;
    }


    Und den Obersten Code nochmal Ändern pls.

    Ganz oben im Script:


    new ReportCall[MAX_PLAYERS];
    new JustReported[MAX_PLAYERS];
    new PlayerNeedsHelp[MAX_PLAYERS];
    #define DIALOG_REPORT 4597


    Bei OnPlayerConnect Noch dashier rein:


    PlayerNeedsHelp[playerid] = 0;
    und
    JustReported[playerid] = 0;
    und
    ReportCall[playerid] = 999;


    Unter OnPlayerDisconnect dahier:


    if(ReportCall[playerid] != 999)
    {
    new sendername[MAX_PLAYER_NAME], string[80];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "[REPORT-SYSTEM] %s Hat den Server verlassen! /report geschlossen", sendername);
    SendClientMessage(playerid, COLOR_LIGHTGREEN,string);
    ReportCall[playerid] = 999;
    }


    Der Report Befehl:


    if(strcmp(cmd, "/report", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(JustReported[playerid] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Bitte warte 30 Sekunden bis du den Nächsten Report schreiben kannst !");
    return 1;
    }
    ShowPlayerDialog(playerid ,DIALOG_REPORT, DIALOG_STYLE_INPUT, "Einen Report senden","Du hast eine Frage oder möchtest einen Cheater melden?\nSchreibe denen Text hier rein:","Senden", "Abbrechen");
    }
    return 1;
    }


    Und dashier unter OnDialogResponse:


    if(dialogid==DIALOG_REPORT)
    {
    if(response)
    {
    new stringrp[200];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    format(stringrp, sizeof(stringrp), "Report von: [ID:%d]%s", playerid, sendername);
    ABroadCast(0xE19898AA,stringrp,1);
    format(stringrp, sizeof(stringrp), "Meldung: %s", (result));
    ABroadCast(0xE19898AA,stringrp,1);
    ABroadCast(0xA04C4CAA,"Tippe '/ar [SpielerID]' or '/tr [SpielerID]'",1);
    SendClientMessage(playerid, 0x96C184AA, " Dein Report wurde an alle Admins gesendet die Online sind.");
    JustReported[playerid] = 1;
    PlayerNeedsHelp[playerid] = 1;
    SetTimerEx("ReportReset", 30000, false, "i", playerid);
    }
    }


    Nun noch die Befehle:


    if(strcmp(cmd, "/cr", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du musst Eingeloggt sein !");
    return 1;
    }
    if(SpielerInfo[playerid][pAdmin] > 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "Benutze: /cr [SpielerID/SpielerName]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "** Adminstrator [ID:%d]%s hat den Report geschlossen!", playerid, sendername);
    SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
    format(string, sizeof(string), "** Du hast den /report geschlossen!", playerid, sendername);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
    ReportCall[playerid] = 999;
    ReportCall[giveplayerid] = 999;
    }
    }
    }
    }
    }
    if(strcmp(cmd, "/ar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du musst Eingeloggt sein !");
    return 1;
    }
    if(SpielerInfo[playerid][pAdmin] > 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "Benutze: /ar [SpielerID/SpielerName]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    if(PlayerNeedsHelp[giveplayerid] == 1)
    {
    PlayerNeedsHelp[giveplayerid] = 0;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "AdmWarnung: %s hat den Report von: [ID:%d]%s Angenommen.", sendername, giveplayerid, giveplayer);
    ABroadCast(COLOR_YELLOW, string, 1);
    SendClientMessage(playerid, COLOR_YELLOW,"Schreib nun mit dem Spieler per Chat du bist Automatisch Verbunden.");
    SendClientMessage(playerid, COLOR_YELLOW,"Du kannst den Report mit '/cr [SpielerID/SpielerName]' schließen");
    format(string, sizeof(string), "** Adminstrator [ID:%d]%s hat dein Report Angenommen, er wird dich nun Supporten.", playerid, sendername);
    SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
    SendClientMessage(giveplayerid, COLOR_LIGHTGREEN,"Du kannst nun per Chat mit dem Admin Schreiben.");
    SendClientMessage(playerid, COLOR_LIGHTGREEN,"Du kannst nun per Chat mit dem Spieler Schreiben.");
    ReportCall[giveplayerid] = playerid;
    ReportCall[playerid] = giveplayerid; //Verbinde zum Reporter
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Der Spieler hat keine Report anfrage !");
    return 1;
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist kein Administrator ! ");
    return 1;
    }
    }
    return 1;
    }


    if(strcmp(cmd, "/tr", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du musst Eingeloggt sein !");
    return 1;
    }
    if(SpielerInfo[playerid][pAdmin] > 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "HINT: /tr [SpielerID/SpielerName]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    if(PlayerNeedsHelp[giveplayerid] == 1)
    {
    PlayerNeedsHelp[giveplayerid] = 0;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "AdmWarning: %s hat die /report Anfrage von [ID:%d]%s gelöscht.", sendername, giveplayerid, giveplayer);
    ABroadCast(COLOR_YELLOW, string, 1);
    format(string, sizeof(string), "** Administrator [ID:%d]%s hat deine /report Anfrage verweigert !", playerid, sendername);
    SendClientMessage(giveplayerid, 0xB35959AA, string);
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Der Spieler hat keine Report anfrage !");
    return 1;
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist kein Administrator ! ");
    return 1;
    }
    }
    return 1;
    }


    Und Damit man auch Reden kann unter OnPlayerText dashier:


    if(ReportCall[playerid] != 999)
    {
    new idx;
    tmp = strtok(text, idx);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "[REPORT-SYSTEM] %s: %s", sendername, text);
    SendClientMessage(playerid, COLOR_LIGHTGREEN,string);
    if(ReportCall[ReportCall[playerid]] == playerid)
    {
    SendClientMessage(ReportCall[playerid], COLOR_LIGHTGREEN,string);
    }
    return 0;
    }


    Und damit man nach 30s auch wieder einen Report schreiben kann dashier unten ins Script:


    forward ReportReset(playerid);
    public ReportReset(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    if(JustReported[playerid] == 1)
    {
    JustReported[playerid] = 0;
    }
    }
    }


    xSpiderx


    PS: Falls was falsch ist oder was fehlt melden.