Veteran Member
Join Date: Sep 2008
Location: Bucuresti , Romania
|
05-17-2011
, 10:31
Re: ProKreedz 2.27
|
#472
|
Finish was planned to be implemented in the new version, but as I mentioned before I stopped temporarily working on this plugin
About Wpn15, shouldn't be hard...
Header:
PHP Code:
new Float:Wpn_Tiempos[24] new Wpn_AuthIDS[24][32] new Wpn_Names[24][32] new Wpn_Date[24][32] new Wpn_CheckPoints[24] new Wpn_GoChecks[24] new Wpn_Weapons[24]
PHP Code:
register_clcmd("say /wpn15","WpnTop_show")
PHP Code:
public finish_climb(id) { if (!is_user_alive (id)) { return; } if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) ) { ColorChat(id , GREEN, "[XJ]^x01 Top 15 is disabled.") return ; }
new Float: time, authid[32], weapon get_user_authid(id, authid, 31) time = get_gametime() - timer_time[id] show_finish_message(id, time) timer_started[id] = false weapon= get_user_weapon(id); if (gochecknumbers[id] == 0 && !user_has_weapon(id,CSW_SCOUT) ) ProTop_update(id, time) else if (gochecknumbers[id] > 0 || user_has_weapon(id,CSW_SCOUT) ) NoobTop_update(id, time, checknumbers[id], gochecknumbers[id]) else WpnTop_Update(id, time, checknumbers[id], gochecknumbers[id], weapon)
}
PHP Code:
public NoobTop_update(id, Float:time, checkpoints, gochecks, weapon) { new authid[32], name[32], thetime[32]; get_user_name(id, name, 31); get_user_authid(id, authid, 31); get_time(" %d/%m/%Y ", thetime, 31); new bool:Is_in_Wpn15 Is_in_Wpn15 = false for(new i = 0; i < 15; i++) { if( (equali(Wpn_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Wpn_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) ) { Is_in_Wpn15 = true } } for (new i = 0; i < 15; i++) { new Float:slower = time - Wpn_Tiempos[i]; new Float:faster = Wpn_Tiempos[i] - time; new Float:noobtiempo = Wpn_Tiempos[i] if( time < Wpn_Tiempos[i]) { new pos = i if ( get_pcvar_num(kz_top15_authid) == 0 ) while( !equal(Wpn_Names[pos], name) && pos < 15 ) { pos++; } else if ( get_pcvar_num(kz_top15_authid) == 1) while( !equal(Wpn_AuthIDS[pos], authid) && pos < 15 ) { pos++; } for (new j = pos; j > i; j--) { formatex(Wpn_AuthIDS[j], 31, Wpn_AuthIDS[j-1]); formatex(Wpn_Names[j], 31, Wpn_Names[j-1]); formatex(Wpn_Date[j], 31, Wpn_Date[j-1]); Wpn_Tiempos[j] = Wpn_Tiempos[j-1] Wpn_CheckPoints[j] = Wpn_CheckPoints[j-1] Wpn_GoChecks[j] = Wpn_GoChecks[j-1] Wpn_Weapon[j] = Wpn_Weapon[j-1] } formatex(Wpn_AuthIDS[i], 31, authid); formatex(Wpn_Names[i], 31, name); formatex(Wpn_Date[i], 31, thetime) Wpn_Tiempos[i] = time Wpn_CheckPoints[i] = checkpoints Wpn_GoChecks[i] = gochecks Wpn_Weapons[id] = weapon save_Wpn15() if( Is_in_Wpn15 ) {
if( time < noobtiempo ) { new min, Float:sec; min = floatround(faster, floatround_floor)/60; sec = faster - (60*min); ColorChat(id, GREEN, "[XJ]^x01 You improved your time by ^x03%02d:%s%.2f^x01", min, sec < 10 ? "0" : "", sec); if( (i + 1) == 1) { client_cmd(0, "spk woop") ColorChat(0, GREEN, "[XJ]^x01^x03 %s^x01 is now^x03 Leet^x01 in ^x04Weapons Top 15^x01" , name); } else { client_cmd(0, "spk buttons/bell1") ColorChat(0, GREEN, "[XJ]^x01^x03 %s^x01 is now on place^x03 %d^x01 in ^x04Weapons Top 15^x01" , name , (i+1)); } } } else { if( (i + 1) == 1) { client_cmd(0, "spk woop"); ColorChat(0, GREEN, "[XJ]^x01^x03 %s^x01 is now^x03 Leet^x01 in ^x04Weapons Top 15^x01" , name); } else { client_cmd(0, "spk buttons/bell1"); ColorChat(0, GREEN, "[XJ]^x01^x03 %s^x01 is now on place^x03 %d^x01 in ^x04Weapons Top 15^x01" , name , (i+1)); } } return; }
if( (equali(Wpn_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Wpn_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) ) { if( time > noobtiempo ) { new min, Float:sec; min = floatround(slower, floatround_floor)/60; sec = slower - (60*min); ColorChat(id, GREEN, "[XJ]^x01 You failed your time by ^x03%02d:%s%.2f^x01", min, sec < 10 ? "0" : "", sec); return; } } } }
public save_Wpn15() { new mapname[33], profile[128] get_mapname(mapname, 32) formatex(profile, 127, "%s/Wpn_%s.cfg", KZ_TOP15_DIR, mapname) if( file_exists(profile) ) { delete_file(profile) } new Data[256]; new f = fopen(profile, "at") for(new i = 0; i < 15; i++) { formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%i^" ^"%i^" ^"%s^" ^n", Wpn_Tiempos[i], Wpn_AuthIDS[i], Wpn_Names[i],Wpn_CheckPoints[i], Wpn_GoChecks[i],Wpn_Date[i]) fputs(f, Data) } fclose(f); }
public read_Wpn15() { new mapname[33], profile[128], prodata[256] get_mapname(mapname, 32) formatex(profile, 127, "%s/Wpn_%s.cfg", KZ_TOP15_DIR, mapname) new f = fopen(profile, "rt" ) new i = 0 while( !feof(f) && i < 16) { fgets(f, prodata, 255) new totime[25], checks[5], gochecks[5] parse(prodata, totime, 24, Wpn_AuthIDS[i], 31, Wpn_Names[i], 31, checks, 4, gochecks, 4, Wpn_Date[i], 31, weapon, 31) // if you can't compile use Wpn_Weapons[i] instead of weapon and deletete the line where I said 'NOT SURE', but it will show CSW_ In front of the weapons and also big characters (CSW_AWP, CSW_KNIFE, CSW_DEAGLE) Wpn_Tiempos[i] = str_to_float(totime) Wpn_CheckPoints[i] = str_to_num(checks) Wpn_GoChecks[i] = str_to_num(gochecks) strtolower (strncpy (weapon, Wpn_Weapons[i], 4)) // NOT SURE i++; } fclose(f) }
public WeaponTop_show(id) { new buffer[2048], name[32], len
len = formatex(buffer, 2047, "<body bgcolor=#3399FF><table width=100%% cellpadding=2 cellspacing=0 border=0>") len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#0052FF><th width=5%%> # <th width=35%% align=center> Player <th width=20%%> Time <th width=10%%> CP's <th width=10%%> GC's <th width=20%%> Weapon") for (new i = 0; i < 10; i++) { if( Noob_Tiempos[i] > 9999999.0 ) { len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#5DA5FF" : " bgcolor=#3399FF", (i+1), "", "", "", "", "") }
else { name = Noob_Names[i] new minutos, Float:segundos minutos = floatround(Noob_Tiempos[i], floatround_floor)/60 segundos = Noob_Tiempos[i] - (60*minutos) len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> <b>%02d:%s%.2f <td> %d <td> %d <td> %s", ((i%2)==0) ? " bgcolor=#5DA5FF" : " bgcolor=#3399FF", (i+1), Noob_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Noob_CheckPoints[i], Noob_GoChecks[i], Noob_Date[i]) } } len += formatex(buffer[len], 2047-len, "</table></body>") len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>Plugin created by p4ddY & nucLeaR") show_motd(id, buffer, "Weapon 10 Top")
return PLUGIN_HANDLED }
PS: Might be slight mistakes since I used replace.
PSS: Read the // I wrote at the last part
__________________
My nickname is nucLeaR, I just screwed up at registering and didn't want to change after that X_X.
Last edited by NucL3ra; 05-17-2011 at 10:49.
|
|