Jump to content

[TUTORIAL] random statistica a serverului


khain.dev

Recommended Posts

Astazi o sa va invat cum puteti face o random statistica a serverului unde in fiecare ora jucatorii primesc diferita informatie despre tot ce se intimpla pe server,deci sa trecem la treaba!
 
Citat

// mai intii creem variabile

new StatsArray3[StatsEnum];  

static const StatsArray1[][] =
{
    
"%d - anume atat %s de la ultima ora ",
    
"Anume in aceasta ora  %d au fost %s",
    
"Numarul orei: %d. Atata a fost %s de la ora anterioara"
},

StatsArray2[][] =
{
    
"jucatori omorati",
    
"jucatori inecati",
    
"jucatori accidentati de automobil",
    
"jucatori explodati",
    
"automobile explodate",
    
"focuri din arma",
    
"lovituri cu succes",
    
"lovituri in cap",
    
"comenzi introduse de jucatori",
    
"text trimis in chat",
    
"intrati pe server",
    
"schimbarea culorii automobilelor",
    
"instalare tuning automobilului",
    
"pickup alese de jucatori",
    
"checkpoint prinse de jucatori",
    
"checkpoint de cursa prinse de jucatori"
};

Citat

//enum

enum StatsEnum
{
    
sKilledPlayers,
    
sDrownedPlayers,
    
sCrushedPlayers,
    
sExplodedPlayers,
    
sBlownVehicles,
    
sCreatedShoots,
    
sSuccessShots,
    
sHeadShots,
    
sSendedCmds,
    
sSendedChat,
    
sConnects,
    
sResprays,
    
sModded,
    
sPickUps,
    
sEnteredCps,
    
sEnteredRaceCps
 

Citat

// trecem la publicuri

public OnPlayerConnect(playerid)
{
    
StatsArray3[sConnects]++;
    return 
1;
 

public OnPlayerDeath(playeridkilleridreason)
{
    
StatsArray3[sKilledPlayers]++;
    switch(
reason)
    {
        case 
49StatsArray3[sCrushedPlayers]++; //a fost accidentat de automobil
        
case 51StatsArray3[sExplodedPlayers]++; // a fost explodat
        
case 53StatsArray3[sDrownedPlayers]++; //a inecat
    
}
    return 
1;

public OnPlayerText(playeridtext[])
{
    
StatsArray3[sSendedChat]++;
    return 
1;
 

public OnPlayerCommandText(playeridcmdtext[])
{
    
StatsArray3[sSendedCmds]++;
    return 
0;
 

public OnPlayerPickUpPickup(playeridpickupid)
{
    
StatsArray3[sPickUps]++;
    return 
1;
 

public OnPlayerEnterCheckpoint(playerid)
{
    
StatsArray3[sEnteredCps]++;
    return 
1;

public OnPlayerEnterRaceCheckpoint(playerid)
{
    
StatsArray3[sEnteredRaceCps]++;
    return 
1;
 

public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 9StatsArray3[sHeadShots]++; //9 este capul ( headshot)
    
return 1;
 

public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    
StatsArray3[sCreatedShoots]++;
    if(
hittypeStatsArray3[sSuccessShots]++; //lovituri reusite
    
return 1;
 

public OnVehicleRespray(playeridvehicleidcolor1color2)
{
    
StatsArray3[sResprays]++;
    return 
1;
 

public OnVehicleMod(playerid,vehicleid,componentid)
{
    
StatsArray3[sModded]++;
    return 
1;
 

public OnVehicleDeath(vehicleidkillerid)
{
    
StatsArray3[sBlownVehicles]++;
    return 
1;

Citat

//in orice loc al modului chiar si la sfarsit

forward OneHourTimer();
public 
OneHourTimer()
{
    new 
strtmp[128], rand random(sizeof StatsArray2), rand2 random(sizeof StatsArray1);
    
format(strtmpsizeof strtmpStatsArray1[rand2], StatsArray3[StatsEnum:rand], StatsArray2[rand]);
    
SendClientMessageToAll(0xFFFFFFFFstrtmp); 
    for(new sizeof(StatsArray3) - 1!= -1; --iStatsArray3[StatsEnum:i] = 0//update
    
return 1;
 

 

Mersi de atentie,astept macar un "+" de staruinta ?

Edited by K H A I N
  • Like 2
[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

17 hours ago, #Yudin said:
Astazi o sa va invat cum puteti face o random statistica a serverului unde in fiecare ora jucatorii primesc diferita informatie despre tot ce se intimpla pe server,deci sa trecem la treaba!
 

 

Mersi de atentie,astept macar un "+" de staruinta ?

Interesant ce ai facut tu aici, asta se poate folosi si la alte chestii, nu neaparat la o statistica a serverului, dar interesant!

  • Like 1

Ai nevoie de ajutor in scripting si nu ai bani? Te pot ajuta cu mare drag. Dar asta nu inseamna sa iti lucrez un Sistem de joc complet, daca ai nevoie de ajutor ma poti contacta pe Discord.ezgif-2-3a38433e2465.gif.9283810e304f5e405309769455e5e14b.gif

Link to comment
Share on other sites

Acum 1 minut, razvanduciuc a spus:

Interesant ce ai facut tu aici, asta se poate folosi si la alte chestii, nu neaparat la o statistica a serverului, dar interesant!

Mersi,am dat doar un exemplu,fiecare o sa realizeze cum doreste el deja

[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

  • 1 month later...

Mersi

[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.