Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Possible to replace this code into Y_INI ?

 
  • 0 Vote(s) - 0 Average
Pawn Possible to replace this code into Y_INI ?
mems
Offline

Burgershot Member
Posts: 31
Threads: 3
Joined: Sep 2020
Reputation: 0
#1
2020-09-26, 12:38 PM (This post was last modified: 2020-09-26, 12:42 PM by mems.)
hello,

i couldn't connect to forum.sa-mp.com for a question i wanted to post, and i searched on why it's removed or something, until i found out that this forum is similar to forum.sa-mp.com, if not the same. anyways, to the question. is it possible to replace the following code into Y_INI ? cbug, time/name related.

PHP Code:
//=============================| CBUG System |================================//
    if(matching[playerid] ==1 && GetPlayerWeapon(playerid) == 24)
    {
        new playerammo = GetPlayerAmmo(playerid);
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
        if(playerammo != ammo[playerid])
        {
            ammo[playerid]=playerammo;
            if(ammo[playerid]== 6) return ptickcount[playerid] = GetTickCount();
            if(ammo[playerid]== 0)
            {
                ammo[playerid] =-1;
                matching[playerid] =0;
                new string[32];
                new time = GetTickCount()-ptickcount[playerid];
                format(string, sizeof(string),"Time: %s seconds (/records)", Comma(time));
                SendClientMessage(playerid, COLOR_WHITE, string);
                SetPlayerPos(playerid, px[playerid], py[playerid], pz[playerid]);
                for(new j=0; j<11; j++) GivePlayerWeapon(playerid, Weapons[playerid][j], Ammo[playerid][j]);
                if(top1 == -1)
                {
                    top1 = time;
                    format(topname1, sizeof(topname1), "%s", pname);
                    return 1;
                }
                else if(time < top1)
                {
                    top5 = top4;
                    top4 = top3;
                    top3 = top2;
                    top2 = top1;
                    top1 = time;
                    format(topname5, sizeof(topname5), "%s", topname4);
                    format(topname4, sizeof(topname4), "%s", topname3);
                    format(topname3, sizeof(topname3), "%s", topname2);
                    format(topname2, sizeof(topname2), "%s", topname1);
                    format(topname1, sizeof(topname1), "%s", pname);
                    return 1;
                }
                else if(top2 == -1)
                {
                    top2 = time;
                    format(topname2, sizeof(topname2), "%s", pname);
                    return 1;
                }
                else if(time < top2)
                {
                    top5 = top4;
                    top4 = top3;
                    top3 = top2;
                    top2 = time;
                    format(topname5, sizeof(topname5), "%s", topname4);
                    format(topname4, sizeof(topname4), "%s", topname3);
                    format(topname3, sizeof(topname3), "%s", topname2);
                    format(topname2, sizeof(topname2), "%s", pname);
                    return 1;
                }
                else if(top3 == -1)
                {
                    top3 = time;
                    topname3 = pname;
                    return 1;
                }
                else if(time < top3)
                {
                    top5 = top4;
                    top4 = top3;
                    top3 = time;
                    format(topname5, sizeof(topname5), "%s", topname4);
                    format(topname4, sizeof(topname4), "%s", topname3);
                    format(topname3, sizeof(topname3), "%s", pname);
                    return 1;
                }
                else if(top4 == -1)
                {
                    top4 = time;
                    format(topname4, sizeof(topname4), "%s", pname);
                    return 1;
                }
                else if(time < top4)
                {
                    top5 = top4;
                    top4 =time;
                    format(topname5, sizeof(topname5), "%s", topname4);
                    format(topname4, sizeof(topname4), "%s", pname);
                    return 1;
                }
                else if(top5 == -1)
                {
                    top5 = time;
                    format(topname5, sizeof(topname5), "%s", pname);
                    return 1;
                }
                else if(time < top5)
                {
                    top5 = time;
                    format(topname5, sizeof(topname5), "%s", pname);
                    return 1;
                }
                return 1;
}
        }
    }
//============================================================================//
return 1;
} 


if you'd like any other information, please tell me.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#2
2020-09-26, 12:42 PM
There are no file operations there - y_ini is used to save data, you aren't saving any data.
mems
Offline

Burgershot Member
Posts: 31
Threads: 3
Joined: Sep 2020
Reputation: 0
#3
2020-09-26, 12:45 PM (This post was last modified: 2020-09-26, 01:01 PM by mems.)
(2020-09-26, 12:42 PM)Y_Less Wrote: There are no file operations there - y_ini is used to save data, you aren't saving any data.

PHP Code:
public OnGameModeExit()
{
//==============================| CBUG System |===============================//
    
new INI:file = INI_Open("cbugrecords.ini");
    
INI_WriteInt(file,"top1",top1);
    
INI_WriteInt(file,"top2",top2);
    
INI_WriteInt(file,"top3",top3);
    
INI_WriteInt(file,"top4",top4);
    
INI_WriteInt(file,"top5",top5);
    
INI_WriteString(file,"topname1",topname1);
    
INI_WriteString(file,"topname2",topname2);
    
INI_WriteString(file,"topname3",topname3);
    
INI_WriteString(file,"topname4",topname4);
    
INI_WriteString(file,"topname5",topname5);
    
INI_Close(file);
//============================================================================//
    
return 1;
} 

this does, but when i load the server, it doesn't look it like it saves the times + names, it loads the data before i did a good record.

for example: i cbug and the time counter starts, when i finish with all the 7 bullets (deagle), it places me at the 3rd place with a time of 700 millisecs. the problem comes when i stop the server + restart it, it doesn't load the 700 ms time which is placed at 3.

edit: i have also a few other stuff but i don't think they would help..
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#4
2020-09-26, 03:04 PM
There's no tag.
mems
Offline

Burgershot Member
Posts: 31
Threads: 3
Joined: Sep 2020
Reputation: 0
#5
2020-09-26, 03:52 PM
(2020-09-26, 03:04 PM)Y_Less Wrote: There's no tag.
how do i add tags then, how does it work ?
mems
Offline

Burgershot Member
Posts: 31
Threads: 3
Joined: Sep 2020
Reputation: 0
#6
2020-09-26, 07:19 PM
bump..
mems
Offline

Burgershot Member
Posts: 31
Threads: 3
Joined: Sep 2020
Reputation: 0
#7
2020-09-27, 12:04 AM
after many tries and many script changes, i finally found something similar which worked. if anything wrong happens, i will update the situation.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode