Beiträge von xuNsHiNe

    Hi ich habe gerade mal die Funktion vom Leben benutzen wollen..


    so..


    OnPlayerSpawn
    SpielerInfo[playerid][pHealth] = mysql_GetFloat("accounts", "Health", "Name", SpielerInfo[playerid][pName]);
    SetPlayerHealth(playerid,SpielerInfo[playerid][pHealth]);


    LoadPlayer
    SpielerInfo[playerid][pHealth] = mysql_GetFloat("accounts", "Health", "Name", SpielerInfo[playerid][pName]);


    SavePlayer
    mysql_SetFloat("accounts", "Health", SpielerInfo[playerid][pHealth], "Name", SpielerInfo[playerid][pName]);


    Warning

    Code
    C:\Users\Marcel\Desktop\gta_server\gamemodes\Test.pwn(588) : warning 213: tag mismatch
    Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
    
    
    
    
    1 Warning.


    Zeile 588
    stock mysql_GetFloat(Table[], Field[], Where[], Is[])
    {
    new query[128], Float:sqlfloat;
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_float(sqlfloat);
    mysql_free_result();
    return sqlfloat; //Zeile 588
    }


    Was Mache ich falsch?


    lg Marci

    oh fuck jo des is weil ich ocmd benutze..


    Hier is der cmd nur als ocmd


    ocmd.inc



    ocmd:news(playerid,params[])
    {
    if(gTeam[playerid] == TEAM_REPORTER)
    {
    new name1[MAX_PLAYER_NAME];
    new nachricht,string[128];
    GetPlayerName(playerid,name1,sizeof(name1));
    if(sscanf(params,"s",nachricht))return SendClientMessage(playerid, COLOR_GRAD2,"/news [TEXT]");
    format(string,sizeof(string),"[Newsreporter]%s:%s",name1,nachricht);
    SendClientMessageToAll(COLOR_ORANGE, string);
    }
    return 1;
    }

    Probiere es mal so


    if(!strcmp(strget(cmdtext,0),"/news")) // Der Befehl
    {
    if(gTeam[playerid] == TEAM_REPORTER)
    {
    new name1[MAX_PLAYER_NAME];
    new nachricht,string[128];
    GetPlayerName(playerid,name1,sizeof(name1));
    if(sscanf(params,"s",nachricht))return SendClientMessage(playerid, COLOR_GRAD2,"/news [TEXT]");
    format(string,sizeof(string),"[Newsreporter]%s:%s",name1,nachricht);
    SendClientMessageToAll(COLOR_ORANGE, string);
    }
    return 1;
    }


    sscanf


    stock sscanf(sstring[], format[], {Float,_}:...)
    {
    #if defined isnull
    if (isnull(sstring))
    #else
    if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
    #endif
    {
    return format[0];
    }
    #pragma tabsize 4
    new
    formatPos = 0,
    sstringPos = 0,
    paramPos = 2,
    paramCount = numargs(),
    delim = ' ';
    while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
    {
    sstringPos++;
    }
    while (paramPos < paramCount && sstring[sstringPos])
    {
    switch (format[formatPos++])
    {
    case '\0':
    {
    return 0;
    }
    case 'i', 'd':
    {
    new
    neg = 1,
    num = 0,
    ch = sstring[sstringPos];
    if (ch == '-')
    {
    neg = -1;
    ch = sstring[++sstringPos];
    }
    do
    {
    sstringPos++;
    if ('0' <= ch <= '9')
    {
    num = (num * 10) + (ch - '0');
    }
    else
    {
    return -1;
    }
    }
    while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num * neg);
    }
    case 'h', 'x':
    {
    new
    num = 0,
    ch = sstring[sstringPos];
    do
    {
    sstringPos++;
    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));
    }
    default:
    {
    return -1;
    }
    }
    }
    while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num);
    }
    case 'c':
    {
    setarg(paramPos, 0, sstring[sstringPos++]);
    }
    case 'f':
    {


    new changestr[16], changepos = 0, strpos = sstringPos;
    while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
    {
    changestr[changepos++] = sstring[strpos++];
    }
    changestr[changepos] = '\0';
    setarg(paramPos,0,_:floatstr(changestr));
    }
    case 'p':
    {
    delim = format[formatPos++];
    continue;
    }
    case '\'':
    {
    new
    end = formatPos - 1,
    ch;
    while ((ch = format[++end]) && ch != '\'') {}
    if (!ch)
    {
    return -1;
    }
    format[end] = '\0';
    if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
    {
    if (format[end + 1])
    {
    return -1;
    }
    return 0;
    }
    format[end] = '\'';
    sstringPos = ch + (end - formatPos);
    formatPos = end + 1;
    }
    case 'u':
    {
    new
    end = sstringPos - 1,
    id = 0,
    bool:num = true,
    ch;
    while ((ch = sstring[++end]) && ch != delim)
    {
    if (num)
    {
    if ('0' <= ch <= '9')
    {
    id = (id * 10) + (ch - '0');
    }
    else
    {
    num = false;
    }
    }
    }
    if (num && IsPlayerConnected(id))
    {
    setarg(paramPos, 0, id);
    }
    else
    {
    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    sstring[end] = '\0';
    num = false;
    new
    name[MAX_PLAYER_NAME];
    id = end - sstringPos;
    foreach (Player, playerid)
    {
    GetPlayerName(playerid, name, sizeof (name));
    if (!strcmp(name, sstring[sstringPos], true, id))
    {
    setarg(paramPos, 0, playerid);
    num = true;
    break;
    }
    }
    if (!num)
    {
    setarg(paramPos, 0, INVALID_PLAYER_ID);
    }
    sstring[end] = ch;
    #if defined __SSCANF_FOREACH__
    #undef foreach
    #undef __SSCANF_FOREACH__
    #endif
    }
    sstringPos = end;
    }
    case 's', 'z':
    {
    new
    i = 0,
    ch;
    if (format[formatPos])
    {
    while ((ch = sstring[sstringPos++]) && ch != delim)
    {
    setarg(paramPos, i++, ch);
    }
    if (!i)
    {
    return -1;
    }
    }
    else
    {
    while ((ch = sstring[sstringPos++]))
    {
    setarg(paramPos, i++, ch);
    }
    }
    sstringPos--;
    setarg(paramPos, i, '\0');
    }
    default:
    {
    continue;
    }
    }
    while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
    {
    sstringPos++;
    }
    while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
    {
    sstringPos++;
    }
    paramPos++;
    }
    do
    {
    if ((delim = format[formatPos++]) > ' ')
    {
    if (delim == '\'')
    {
    while ((delim = format[formatPos++]) && delim != '\'') {}
    }
    else if (delim != 'z')
    {
    return delim;
    }
    }
    }
    while (delim > ' ');
    return 0;
    }

    Habe gerade Getestet..


    mit der server.cfg geht es..



    lg Marci


    ps: Nimm die IP -> 127.0.0.1:7777

    public OnPlayerDisconnect(playerid, reason)
    {
    SavePlayer(playerid);
    DeletePVar(playerid,"Eingeloggt");
    new string[150];
    new sendername[MAX_PLAYER_NAME];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    GetPlayerName(playerid, pname, sizeof(pname));


    switch(reason)
    {
    case 0: format(string, sizeof(string), "%s hat den Server verlassen. [ Timeout ]", pname);
    case 1: format(string, sizeof(string), "%s hat den Server verlassen. [ Disconnect ]", pname);
    case 2: format(string, sizeof(string), "%s hat den Server verlassen. [ Kick/Ban ]", pname);
    }


    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
    }


    //Edit: In PWN BB Eingebunden

    Moin,


    Ich bastell gerade an einem Bann System..


    Hier ist der cmd


    ocmd:ban(playerid,params[])
    {
    new name1[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    if(SpielerInfo[playerid][pAdminlevel]>=2)
    {
    new pID, reason[128], string[128];
    GetPlayerName(playerid,name1,sizeof(name1));
    GetPlayerName(pID,name2,sizeof(name2));
    if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid, COLOR_GRAD2, "/ban [ID/NAME] [GRUND]");
    format(string,sizeof(string),"AdmCmd: Spieler %s wurde von Admin %s gebannt. Grund: %s",name1,name2,reason);
    SendClientMessageToAll(COLOR_RED2,string);
    SpielerInfo[pID][pBanned] = 1;
    Ban(pID);
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2,"Du bist kein Admin!");
    }
    return 1;
    }


    Hier die Abfrage


    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    if(SpielerInfo[playerid][pBanned] == 1) //autoban
    {
    format(string2,sizeof(string2)," %s versucht mit seinem gebannten Account online zu kommen und wurde gekickt!",playername2);
    ABroadCast(COLOR_LIGHTRED,string2,1);
    SetPlayerPos(playerid,1137.1897,-1455.0825,15.7969);
    SetPlayerCameraPos(playerid, 1137.1897,-1455.0825,15.7969);
    SetPlayerCameraLookAt(playerid, 1127.6664,-1483.0823,22.7690);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," Dein Account ist gebannt! Mach dir mal Gedanken, warum...");
    SendClientMessage(playerid,COLOR_RED," Falls dies ein Fehlbann sein sollte, stelle einen Enbannungs Antrag.");
    SendClientMessage(playerid,COLOR_RED," Anträge bitte ins Forum posten. www.German-StreetZ.de.pn");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    Kick(playerid);
    return 1;
    }


    Und hier der Screen von mysql


    so mein Problemm..


    wenn ich /ban eingebe kommt immer "/ban: Du bist kein Admin" obwohl ich Level 5 Admin bin.
    wenn ich es manuel auf 1 Stelle und connecte kann ich mich immer noch einloggen und wenn ich wieder Dissconnecte ist bei Banned = -1


    Was mache ich falsch?



    lg Marci

    Moin,


    Ich bastell gerade an einem Bann System..


    Hier ist der cmd


    ocmd:ban(playerid,params[])
    {
    new name1[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    if(SpielerInfo[playerid][pAdminlevel]>=2)
    {
    new pID, reason[128], string[128];
    GetPlayerName(playerid,name1,sizeof(name1));
    GetPlayerName(pID,name2,sizeof(name2));
    if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid, COLOR_GRAD2, "/ban [ID/NAME] [GRUND]");
    format(string,sizeof(string),"AdmCmd: Spieler %s wurde von Admin %s gebannt. Grund: %s",name1,name2,reason);
    SendClientMessageToAll(COLOR_RED2,string);
    SpielerInfo[pID][pBanned] = 1;
    Ban(pID);
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2,"Du bist kein Admin!");
    }
    return 1;
    }


    Hier die Abfrage


    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    if(SpielerInfo[playerid][pBanned] == 1) //autoban
    {
    format(string2,sizeof(string2)," %s versucht mit seinem gebannten Account online zu kommen und wurde gekickt!",playername2);
    ABroadCast(COLOR_LIGHTRED,string2,1);
    SetPlayerPos(playerid,1137.1897,-1455.0825,15.7969);
    SetPlayerCameraPos(playerid, 1137.1897,-1455.0825,15.7969);
    SetPlayerCameraLookAt(playerid, 1127.6664,-1483.0823,22.7690);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," Dein Account ist gebannt! Mach dir mal Gedanken, warum...");
    SendClientMessage(playerid,COLOR_RED," Falls dies ein Fehlbann sein sollte, stelle einen Enbannungs Antrag.");
    SendClientMessage(playerid,COLOR_RED," Anträge bitte ins Forum posten. www.German-StreetZ.de.pn");
    SendClientMessage(playerid,COLOR_RED," ");
    SendClientMessage(playerid,COLOR_RED," ");
    Kick(playerid);
    return 1;
    }


    Und hier der Screen von mysql


    so mein Problemm..


    wenn ich /ban eingebe kommt immer "/ban: Du bist kein Admin" obwohl ich Level 5 Admin bin.
    wenn ich es manuel auf 1 Stelle und connecte kann ich mich immer noch einloggen und wenn ich wieder Dissconnecte ist bei Banned = -1


    Was mache ich falsch?



    lg Marci

    Versuche mal


    format(string, sizeof(string), "~g~Gehaltscheck~n~~w~Payday");
    GameTextForPlayer(i, string, 5000, 1);


    bei Public PayDay einzufügen


    bin mir nicht sicher :)

    Hallo..


    Habe nun ein Anderes System gefunden...


    Hier ist der stock
    stock isPlayerAnAdmin(playerid,rang)
    {
    if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
    return 0;
    }


    /setadmin


    if(strcmp(cmd, "/setadmin", true) == 0)
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"Du bist kein Admin.");
    new pID, rank;
    if(sscanf(params,"ui",pID,rank))return SendClientMessage(playerid,ROT,"/setadmin [spieler] [level]");
    if(rank<1||rank>5)return SendClientMessage(playerid,ROT,"Bitte gültigen Rang angeben.");
    SetPVarInt(pID,"Adminlevel",rank);
    SpielerSpeichern(pID);
    SendClientMessageToAll(BLAU,"Es wurde jemand zu Admin gemacht.");
    return 1;
    }


    wie müsste ich es umschreiben auf mysql?


    kann mir einer dass erklären


    lg Marci