Beiträge von IPhone1337

    Guten Tag,
    ich möchte ein Clan - System auf Mysql Basis erstellen.
    Ich hab es bis jetzt geschafft das sie erstellt werden, doch wie ich sie lade oder wie ich es mache das der Spieler zu einem Clan gehört habe ich keine Ahnung
    Könnt ihr mir helfen?



    #define MAX_CLANS 50
    enum ClanData
    {
    cName[34],
    cID,
    cLeader,
    cMember
    }
    new cClan[MAX_CLANS][ClanData];



    COMMAND:createclan(playerid,params[])
    {
    new cn[32],str[64],query[164];
    if(sscanf(params,"s",cn)) return SendClientMessage(playerid,GRAU,"BENUTZE: /createclan [Clan-Name]");
    for(new i = 1; i<MAX_CLANS; i++)
    {
    if(cClan[i][cID] >= 1)continue;
    cClan[i][cID] = i;
    format(cClan[i][cName],32,"%s",cn);
    mysql_format(mycon,query, sizeof(query), "INSERT INTO `clans` (`ClanName`, `ClanID`) VALUES('%s','%d')",cClan[i][cName],cClan[i][cID]);
    mysql_tquery(mycon, query, "", "")';
    format(str,64,"Clan: %s erfolgreich gekauft!",cn);
    return SendClientMessage(playerid,GELB,str);
    }
    return 1;
    }

    Guten Tag,
    ich möchte ein Clan - System auf Mysql Basis erstellen.
    Ich hab es bis jetzt geschafft das sie erstellt werden, doch wie ich sie lade oder wie ich es mache das der Spieler zu einem Clan gehört habe ich keine Ahnung
    Könnt ihr mir helfen?



    #define MAX_CLANS 50
    enum ClanData
    {
    cName[34],
    cID,
    cLeader,
    cMember
    }
    new cClan[MAX_CLANS][ClanData];



    COMMAND:createclan(playerid,params[])
    {
    new cn[32],str[64],query[164];
    if(sscanf(params,"s",cn)) return SendClientMessage(playerid,GRAU,"BENUTZE: /createclan [Clan-Name]");
    for(new i = 1; i<MAX_CLANS; i++)
    {
    if(cClan[i][cID] >= 1)continue;
    cClan[i][cID] = i;
    format(cClan[i][cName],32,"%s",cn);
    mysql_format(mycon,query, sizeof(query), "INSERT INTO `clans` (`ClanName`, `ClanID`) VALUES('%s','%d')",cClan[i][cName],cClan[i][cID]);
    mysql_tquery(mycon, query, "", "")';
    format(str,64,"Clan: %s erfolgreich gekauft!",cn);
    return SendClientMessage(playerid,GELB,str);
    }
    return 1;
    }

    Hey,
    ich habe einn Cbugsystem geschrieben, doch die Spieler können immer noch 'leicht' cbuggen.
    Also das System greift nicht richtig zu



    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if(CBugAktiv[playerid] == 0)
    {
    if(newkeys & KEY_FIRE && oldkeys & KEY_CROUCH && IsBugWeapon(playerid)){
    PlayerUsingBug[playerid] = 1;
    PlayerBugTimer[playerid] = SetTimerEx("BugTimeOut",1000,0,"i",playerid);
    }
    if(PlayerUsingBug[playerid]==1 && newkeys != KEY_FIRE && newkeys & KEY_CROUCH){
    ApplyAnimation(playerid,"PED","getup",4.1,0,0,0,0,0);
    PlayerUsingBug[playerid] = 0;
    KillTimer(PlayerBugTimer[playerid]);
    }
    }
    return 1;
    }


    Klappt danke.
    Nächstes Problem:
    Will die Zeit in Sekunden angezeigt bekommen, bekomme die Rechnung nicht hin xd
    Wie würde das gehen?



    COMMAND:muteinfo(playerid,params[])
    {
    #pragma unused params
    new timestamp = gettime();
    new bisgebannt = User[playerid][MuteTime];
    new differenz = bisgebannt - timestamp;
    new minuten = differenz / 60;
    new str[128];
    if(User[playerid][Mute] == 1)
    {
    format(str,128,"[MUTEINFO] Du bist noch %d Minuten gemuted",minuten);
    SendClientMessage(playerid,GELB,str);
    }else{
    SendClientMessage(playerid,GRAU,"Du bist nicht gemuted!");
    }
    return 1;
    }

    Guten Abend,
    mein System funktioniert nicht.
    Also wenn ich den Spieler mute, kann er nicht mehr schreiben, so sollte es auch sein.
    Doch wenn die Mutezeit vorbei ist, ist der Spieler immer noch gemuted...


    Mute Befehl:

    COMMAND:mute(playerid,params[])
    {
    new pID,grund[64],dauer;
    if(!isAnAdmin(playerid,1)) return SendClientMessage(playerid,GRAU,ADMINMELDUNG);
    if(sscanf(params, "us[64]i", pID, grund,dauer))return SendClientMessage(playerid, GRAU, "BENUTZE: /mute [SpielerName/ID] [Grund] [Dauer]");
    muteplayer(playerid,grund,dauer,pID);
    return 1;
    }


    Stock MutePlayer

    stock muteplayer(playerid,const string[],dauer,pID)
    {
    new timestamp,str[264];
    timestamp = gettime();
    new sekunden = dauer * 60;
    timestamp += sekunden;
    new name[MAX_PLAYER_NAME],pIDName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(pID,pIDName,sizeof(pIDName));
    format(str,sizeof(str),"[MUTE]: Der Admin %s hat %s für %d Minuten gemuted, Grund: %s",name,pIDName,dauer,string);
    SendClientMessageToAll(ROT,str);
    User[pID][MuteTime] = timestamp;
    User[pID][Mute] = 1;
    return 1;
    }


    UnMuteTimer

    forward UnMuteTimer();
    SetTimer("UnMuteTimer",60000,1);


    public UnMuteTimer ()
    {
    for(new i;i<MAX_PLAYERS;i++)
    {
    new timestampMute = gettime();
    new bisgemuted = User[i][MuteTime];
    if(timestampMute > bisgemuted)
    {
    User[i][Mute] = 0;
    return 1;
    }
    }
    return 1;
    }


    SavePlayerData:

    stock SavePlayerData(playerid)
    {
    new query[264 + MAX_PLAYER_NAME];
    new day,month,year; getdate(year,month,day);
    format(User[playerid][LastLogin],11,"%d/%d/%d",day,month,year);
    mysql_format(mycon,query, sizeof(query), "UPDATE `User` SET `Geld` = %d,`Level` = %d,`Adminlevel` = %d,`TimeBan` = %d,`Kills` = %d,`Tode` = %d,`Skin` = %d,`Coins` = '%d',`EXP` = '%d',`LastLogin` = '%e', `Premium` = '%d', `PremiumZeit` = '%d', `MuteTime` = '%d', `Mute` = '%d' WHERE `Name` = '%e'",User[playerid][Geld],User[playerid][Level],User[playerid][Admin],User[playerid][TimeBan],User[playerid][Kills],User[playerid][Tode],
    User[playerid][Skin],User[playerid][Coins],User[playerid][LevelPunkte],
    User[playerid][LastLogin],User[playerid][Donator],User[playerid][DonatorBis],User[playerid][MuteTime],User[playerid][Mute],User[playerid][Username]);
    mysql_tquery(mycon,query,"","");
    return 1;
    }
    LoadPlayerData

    new timestampMute = gettime();
    new bisgemuted = User[playerid][MuteTime] = cache_get_field_content_int(0,"MuteTime");


    if(timestampMute > bisgemuted)
    {
    User[playerid][Mute] = 0;
    SendClientMessage(playerid,GELB,"[MUTEINFO] Du kannst nun wieder schreiben");
    }

    Ja, dann musst du im SELECT noch den Name hinzufügen, und im Callback (LoadHightesLevel) noch den Name auslesen.
    Versuche dich daran mal.


    Haut nicht so ganz hin haha :D



    public TopBox()
    {
    mysql_function_query(mycon, "SELECT Level AND Name FROM `User` ORDER BY Level DESC LIMIT 1", true, "LoadHightesLevel", "dd", "playerid",1);
    return 1;
    }
    forward LoadHightesLevel(playerid);
    public LoadHightesLevel(playerid)
    {
    new rows, fields, str[30];
    cache_get_data(rows, fields);
    if(!rows) return 1;
    format(str, sizeof(str), "Max.Level: %d, Name:%s", cache_get_field_content_int(0,"Level"),cache_get_field_content(0,"Name",User[playerid][Username],mycon,34));
    SendClientMessageToAll(ROT,str);
    return 1;
    }


    2168) : error 028: invalid subscript (not an array or too many subscripts): "HightesPlayer"
    was ist an dem enum falsch?

    Vergiss das, was ich vorher geschrieben habe. War falsch.


    Ist die Variable 100% auf 1 gesetzt?
    Wie sieht der komplette Code aus?


    Befehl:

    COMMAND:1o1invite(playerid,params[])
    {
    new str[128],pID,str2[128];
    if(User[playerid][InMap] == 1) return SendClientMessage(playerid,GELB,"Du bist bereits in einer Arena!");
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,GRAU,"BENUTZE: /1o1invite [SpielerName/ID]");
    g_Invite[pID] = playerid;
    format(str,128,"Du hast dem Spieler %s eine 1o1 Anfrage gesendet",PlayerName(pID));
    SendClientMessage(playerid,HELLBLAU,str);
    format(str2,128,"Der Spieler %s hat dich zum 1o1 eingeladen. Klicke auf 'Annehmen' um das 1o1 zu starten",PlayerName(playerid));
    ShowPlayerDialog(pID,DIALOG_INVITE,DIALOG_STYLE_MSGBOX,"LDM | 1o1 Invite",str2,"Annehmen","Abbrechen");
    return 1;
    }


    Response:

    case DIALOG_INVITE:
    {
    if(!response)return 1;
    new world;
    world +=1;
    invite1o1raum[playerid] = 1;
    invite1o1raum[g_Invite[playerid]] = 1;
    SetPlayerArena(playerid);
    SetPlayerArena(g_Invite[playerid]);
    SetPlayerVirtualWorld(playerid,world);
    SetPlayerVirtualWorld(g_Invite[playerid],world);
    }


    stock SetPlayerArena

    stock SetPlayerArena(playerid)
    {
    if(dmspawn[0][playerid] == 1)
    {
    new randomspawn = random(sizeof(DeagleSpawn));
    SetPlayerPos(playerid,DeagleSpawn[randomspawn][0],DeagleSpawn[randomspawn][1],DeagleSpawn[randomspawn][2]);
    SetPlayerInterior(playerid,1);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    }else if(dmspawn[1][playerid] == 1)
    {
    new randomspawn = random(sizeof(DMSpawn));
    SetPlayerPos(playerid,DMSpawn[randomspawn][0],DMSpawn[randomspawn][1],DMSpawn[randomspawn][2]);
    SetPlayerInterior(playerid,10);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201),GivePlayerWeapon(playerid,25,2201),GivePlayerWeapon(playerid,33,2201);
    }else if(dmspawn[2][playerid] == 1)
    {
    new randomspawn = random(sizeof(CBugSpawn));
    SetPlayerPos(playerid,CBugSpawn[randomspawn][0],CBugSpawn[randomspawn][1],CBugSpawn[randomspawn][2]);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201),GivePlayerWeapon(playerid,34,2201);
    }else if(dmspawn[3][playerid] == 1)
    {
    new randomspawn = random(sizeof(TeamDMSpawn));
    SetPlayerPos(playerid,TeamDMSpawn[randomspawn][0],TeamDMSpawn[randomspawn][1],TeamDMSpawn[randomspawn][2]);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201),GivePlayerWeapon(playerid,34,2201),GivePlayerWeapon(playerid,31,2201),GivePlayerWeapon(playerid,25,2201);
    }
    else if(oneraum[0][playerid] == 1)
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,768.2683,-37.4128,1000.5859);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,4);
    }else if(oneraum[1][playerid] == 1)
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,768.2683,-37.4128,1000.5859);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,5);
    }
    else if(oneraum[2][playerid] == 1)
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,768.2683,-37.4128,1000.5859);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,6);
    }else if(oneraum[3][playerid] == 1)
    {
    SetPlayerPos(playerid,1543.9360,-1353.3961,329.4742);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,7);
    }else if(oneraum[4][playerid] == 1)
    {
    SetPlayerPos(playerid,1543.9360,-1353.3961,329.4742);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,8);
    }else if(oneraum[5][playerid] == 1)
    {
    SetPlayerPos(playerid,1543.9360,-1353.3961,329.4742);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    SetPlayerVirtualWorld(playerid,9);
    }else if(invite1o1raum[playerid] == 1)
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,768.2683,-37.4128,1000.5859);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    }
    return 1;
    }


    if(invite1o1raum[playerid] == 1)
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,768.2683,-37.4128,1000.5859);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,2201);
    }


    habs so gemacht in einem Stock was bei OnPlayerSpawn aufgerufen wird.
    Klappt aber net :D