![]() |
|
[Pawn] Possible to replace this code into Y_INI ? - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] Possible to replace this code into Y_INI ? (/showthread.php?tid=1181) |
Possible to replace this code into Y_INI ? - mems - 2020-09-26 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. RE: Possible to replace this code into Y_INI ? - Y_Less - 2020-09-26 There are no file operations there - y_ini is used to save data, you aren't saving any data. RE: Possible to replace this code into Y_INI ? - mems - 2020-09-26 (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.. RE: Possible to replace this code into Y_INI ? - Y_Less - 2020-09-26 There's no tag. RE: Possible to replace this code into Y_INI ? - mems - 2020-09-26 (2020-09-26, 03:04 PM)Y_Less Wrote: There's no tag. how do i add tags then, how does it work ? RE: Possible to replace this code into Y_INI ? - mems - 2020-09-26 bump.. RE: Possible to replace this code into Y_INI ? - mems - 2020-09-27 after many tries and many script changes, i finally found something similar which worked. if anything wrong happens, i will update the situation. |