RSSy MYGO.pl Opublikowano Lipiec 19, 2020 o 19:50 RSSy Udostępnij Opublikowano Lipiec 19, 2020 o 19:50 Hey AM, Can anyone implement an XP nvault system for KZ from my pseudocode into prokreedz 2.31, where players are awarded frags based on the position they acquire in pro15 or nub15? The awards are stored in the vault, and frags are loaded for players who join, based on their SteamID. A single-run plugin can also be made to take all the files in configs/kz/top15, assigning the xp for players based on their steam id, and store them in the same vault. For example: Code: new frags[17] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; //Global array // 1st - 15 frags 2nd - 14 frags 3rd - 13 frags ... 15th - 1 frag, Record doesn't exist/not made yet - 0 frags When a player moves from xth position to yth position, it should detect that change and award frags depending on the rank improvement. The records are loaded from pro_mapname & Noob_mapname, and their respective positions are noted in procurpos[id] and nubcurpos[id], if the player is on the server using steamid comparison. Similarly pronewpos[id] and nubnewpos[id] will store 16 as a false value to prevent any bugs. I've written a pseudocode to understand what should be done: Code: //Assign procurpos, nubcurpos, pronewpos and nubnewpos globally new procurpos[MAX_PLAYERS+1], nubcurpos[MAX_PLAYERS+1], pronewpos[MAX_PLAYERS+1], nubnewpos[MAX_PLAYERS+1]; //Assigning values on client_connect: //Pro Assign function, similar for Nub Assign new profile[128], steamid[32]; formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName) //Topdir and MapName are assigned at start if( file_exists(profile) ) delete_file(profile) new f = fopen(profile, "at") get_user_authid(id, steamid ,31) //Carry out file operations here: for(i=0; i<15; i++) //traverse the file and find the line at which the steamid is present, i stores the line here { if(steamid[id] == Pro_AuthIDS) //if steam id was found in the pro_mapname file procurpos[id] = i+1; //assign the position else if(Pro_Time > 999999.00) //if there are no records present on the map { procurpos[id] = 16; //Assign 16 as fake value for the player break; } } pronewpos[id] = 16; //Assign 16 as fake value, as record hasn't been made yet. fclose(f); //Added to ProTop_update so the frags get updated when a record is made. pronewpos[id] = i+1; //i+1 stores the newest record position in Prokreedz 2.31, similar to the code above if (pronewpos[id] < procurpos[id]) //Pro Award function, similar for Nub Awards { cs_set_user_frags(id, vaultfrags[id] + frags(pronewpos[id]) - frags(procurpos[id]); //Oldth Place -> Newth Place, example: 7th Place -> 3rd Place : Add frags(3)-frags(7) = 7-3 = 4 frags procurpos[id] = pronewpos[id]; //Set the new position } Source: ProKreedz 2.31 by nucLeaR Best regards, MaNaReaver. Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi