Jump to content
  • 0

Ore,minute,secunde


Question

Posted

Salut am un mod de DM si doresc sa pun la /stats sa arate cate ore,minute si secunde a jucat sau macar orele , am incercat cu ptime dar am diferit stats cu GetPlayer.... am mai vazut asa pe mai multe servere :D !

12 answers to this question

Recommended Posts

Guest PlayON
Posted

Sunt destule systeme de admin care au aceasta functie!

Posted

new OreOn[MAX_PLAYERS];
new SecundeOn[MAX_PLAYERS];
public public OnPlayerConnect(playerid)
{
        SetTimerEx("OreOn", (1000 * 60) * 60, true, "i", playerid);
        SetTimerEx("SecundeOn", 1000, true, "i", playerid);
    return 1;
}
forward OreOn(playerid);
public OreOn(playerid)
{
       OreOn[playerid] +=;
}

forward SecundeOn(playerid);
public SecundeOn(playerid)
{
      SecundeOn[playerid] +=;
}

sa mers? :huh:

wtf?I fucking then school??????fuck school :))))

coolte12.png

Guest PlayON
Posted

^^^^^

//Sus de tot in script. Dar inainte de #include <a_samp>

enum P_ENUM_DATA

{

Hours,

Minutes,

Seconds,

  ConnTime,

  TotalTime

};

new zpData[ MAX_PLAYERS ][ P_ENUM_DATA ];

//Pune asta in interioru acestui callback.

public OnPlayerConnect( playerid )

{

    //Cu asta luam timpul total. Mai tarziu il divizam in Ore Minute si Secunde!

    zpData[ playerid ][ ConnTime]  = gettime( );

    return 1;

}

//Asta pune-l in josul scriptului, gamemodului.

//Cu ajutorul acestei functii calculezi secundele, minutele si orele

//petrecute pe server, defapt tot ce face e sa divida, imparta,

//inmulteasca variabila zpData[ playerid ][ ConnTime]

TotalGameTime(playerid, &h=0, &m=0, &s=0)

{

    zpData[ playerid ][ TotalTime ] = ( (gettime() - zpData[ playerid ][ ConnTime ]) + (zpData[ playerid ][ Hours ]*60*60) + (zpData[ playerid ][ Minutes ]*60) + (zpData[ playerid ][ Seconds ]) );

    h = floatround(zpData[ playerid ][ TotalTime ] / 3600, floatround_floor);

    m = floatround(zpData[ playerid ][ TotalTime ] / 60,  floatround_floor) % 60;

    s = floatround(zpData[ playerid ][ TotalTime ] % 60,  floatround_floor);

    return zpData[ playerid ][ TotalTime ];

}

//Folosire:

//Aceasta este o comanda care se pune sub public OnPlayerCommandText

if ( !strcmp( cmdtext, "/stats" ) )

{

    //Cream variabile in care stocamecundele minutele si orele.

    new H, M, S;

   

    //Cu aceasta functie si algorithm gasim secundele minutele si orele si le stocam in H M S

    TotalGameTime( playerid, H, M, S );

    //Cream un string pe care-l formatam sa arate datele.

    new Str[ 256 ];

    //Formatam stringul cu datele H M S.

    format( Str, 256, "Ai stat pe server %d ore %d minute si %d secunde!", H, M, S );

   

    //Trimitem mesajul formatat jucatorului

    SendClientMessage( playerid, 0xFF00FFFF, Str );

    //Comanda a fost procesata, returnam 1.

    return 1;

}

//Ca sa salvezi faci la fel cum am facut la /stats

//doar ca vei folosi systemul tau de scriere/

//citire de fisiere.


Sper ca ti-a fost de ajutor!

Posted

Imi da 5 erori spune ca zpada nu se defineste :| restu merge ok si /stats nu am probleme doar astea cu zpada !

error 010: invalid function or declaration

error 017: undefined symbol "zpData"

warning 215: expression has no effect

error 001: expected token: ";", but found "]"

error 029: invalid expression, assumed zero

fatal error 107: too many error messages on one line

Poftiti si o poza ! o7kgh2.jpg

Guest farse
Posted

pune new in fata la zpData[ MAX_PLAYERS ][ P_ENUM_DATA ];

Guest PlayON
Posted

Imi da 5 erori spune ca zpada nu se defineste :| restu merge ok si /stats nu am probleme doar astea cu zpada !

Poftiti si o poza ! o7kgh2.jpg

AM ZIS DUPA #include <a_samp>

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.