Beiträge von |-|auke

    Sry4pwn: Aber nur mit begrenzter Anzahl von Parametern. Mit einer Direktive wird das nur vom Preprocessor ersetzt. Hier macht es ein kleiner Algorithmus.
    @BlackAce-Junior: Geschwindigkeitstest und Ressourcentest habe ich noch nicht gemacht. Ich habe ehrlich gesagt nicht einmal geguckt ob es so Etwas schon gibt. :D


    Kaliber: Danke :)

    H_Format

    H_Format ist eine einfache kleine Include die beim Scripten viel Zeit sparen kann.

    H_Format übersetzt diese Funktionen

    • SendClientMessage(playerid, color, text[])
    • SendClientMessageToAll(color, text[])
    • SetGameModeText(text[])
    • UpdatePlayer3DTextLabelText(playerid, 3dTextLabel, color, text[])
    • Update3DTextLabelText(3dTextLabel, color, text[])
    • TextDrawSetString(textdraw, text[])
    • SetPVarString(playerid,"varname",text[])

    in Format-Funktionen.
    Somit ist die Formatierungsoption direkt in den Funktionen enthalten.
    So wie man es von z.B. der Funktion printf() kennt.


    Funktionen:

    • SendClientMessagef
      SendClientMessagef(playerid, color, format, { Float , _ } : ... );
    • SendClientMessageToAllf
      SendClientMessageToAllf(color, format, { Float , _ } : ... ); 
    • SetGameModeTextf
      SetGameModeTextf(format, { Float , _ } : ... ); 
    • UpdatePlayer3DTextLabelTextf
      UpdatePlayer3DTextLabelTextf(playerid, 3dTextLabel, color, format, { Float , _ } : ... ); 
    • Update3DTextLabelTextf
      Update3DTextLabelTextf(3dTextLabel, color, format, { Float , _ } : ... ); 
    • TextDrawSetStringf
      TextDrawSetStringf(textdraw, format, { Float , _ } : ... ); 
    • SetPVarStringf
      SetPVarStringf(playerid,"varname", format, { Float , _ } : ... ); 



    Hier ein paar Anwendungsbeispiele:

    Begrüßungsmeldung



    public OnPlayerSpawn(playerid)
    {
    new Playername[ MAX_PLAYER_NAME ];
    GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
    SendClientMessagef(playerid,0xFFFFFFFF,"Hallo %s! Willkommen auf unserem Server.", Playername);
    }

    Gamemodenamen ändern

    #define VERSION "v.1.0.1.2"


    public OnGameModeInit(){
    SetGameModeTextf("XYZ-Reallife %s",VERSION);
    }

    Benachrichtigung bei neuem Spieler

    public OnPlayerSpawn(playerid)
    {
    new Playername[ MAX_PLAYER_NAME ];
    GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
    SendClientMessageToAllf(0xFFFFFFFF,"%s hat sich eingeloggt.", Playername);
    }


    Platzhalter:
    Folgende Platzhalter können momentan genutzt werden:

    • %s = String
    • %d = Integer
    • %i = Integer
    • %f = Float


    Installation:

    • h_format.inc in den include Ordner von pawno einfügen
    • #include <h_format.inc> oben in deinem Gamemode unter #include <a_samp> einfügen
    • Schon können die Funktionen genutzt werden


    Download:

    Ich arbeite momentan immer ein bisschen an SAMPit weiter.
    Benutzern und Kennern von SAMPit wird es wohl schnell auffallen, dass SAMPit ein kleines Facelifting bekommen hat. Wie z.B. die grafische Anzeige des Pings zum Server.
    Zudem läuft das Programm nun stabiler und bekommt eine Funktion namens "SSPC".











    Ich hoffe ich bekomme einige Anregungen und weiter Ideen für das Programm. :)

    Ich weiß nicht was deine ganzen Variablen bedeuten, und wie sie erstellt werden, aber ggf. müsste es so vielleicht gehen:

    if(uniqueZeit[0] >= 7 && uniqueZeit[0] <= 22 && !PI[p][pLotto] && GetTickCount() > TimeoutLotto)
    {
    if(uniqueZeit[1] == 0 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 3 Minuten startet die näschte runde Lotto. (/lotto [1-49])");
    }
    else if(uniqueZeit[1] == 1 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 2 Minuten startet die näschte runde Lotto. (/lotto [1-49])");
    }
    else if(uniqueZeit[1] == 2 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 1 Minute startet die näschte runde Lotto. (/lotto [1-49])");
    }
    else if(uniqueZeit[1] == 3 && uniqueZeit[2] == 0)
    {
    new zahl=1+random(48);
    new gewinn=random(100000);
    format(string,sizeof string,"Die heutige Zahl lautet: %d",zahl);
    SendClientMessageToAll(cGrey,string);
    if(PI[p][pLotto]==zahl)
    {
    format(string,sizeof string,"%s hat den Jackpot geknackt und bekam %d$",PlayerName(p),gewinn);
    SendClientMessageToAll(cGrey,string);
    GiveCash(p,gewinn);
    }
    PI[p][pLotto]=0;
    }
    TimeoutLotto = GetTickCount() + 1000;
    }


    Zeig sonst noch etwas mehr Code.


    if(uniqueZeit[0] >= 7 && uniqueZeit[0] <= 22 && !PI[p][pLotto] && GetTickCount() > TimeoutLotto)
    {
    if(uniqueZeit[1] == 0 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 3 Minuten startet die näschte runde Lotto. (/lotto [1-49])");
    TimeoutLotto = GetTickCount() + 1000;
    }
    else if(uniqueZeit[1] == 1 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 2 Minuten startet die näschte runde Lotto. (/lotto [1-49])");
    TimeoutLotto = GetTickCount() + 1000;
    }
    else if(uniqueZeit[1] == 2 && uniqueZeit[2] == 0)
    {
    SendClientMessageToAll(cGrey,"In 1 Minute startet die näschte runde Lotto. (/lotto [1-49])");
    TimeoutLotto = GetTickCount() + 1000;
    }
    else if(uniqueZeit[1] == 3 && uniqueZeit[2] == 0)
    {
    TimeoutLotto = GetTickCount() + 1000;
    new zahl=1+random(48);
    new gewinn=random(100000);
    format(string,sizeof string,"Die heutige Zahl lautet: %d",zahl);
    SendClientMessageToAll(cGrey,string);
    if(PI[p][pLotto]==zahl)
    {
    format(string,sizeof string,"%s hat den Jackpot geknackt und bekam %d$",PlayerName(p),gewinn);
    SendClientMessageToAll(cGrey,string);
    GiveCash(p,gewinn);
    }
    PI[p][pLotto]=0;
    }
    }


    So ist der Aufbau schon mal etwas logischer und sauberer.
    Wird diese Abfrage
    else if(uniqueZeit[1] == 3 && uniqueZeit[2] == 0)
    überhaupt erfüllt?