Pro Surfers
Posted: 2016 Aug 08 11:17
Sveiki,
Reikia pagalbos pridedant keleta funkcijų į pluginą.
1. Pridėti komandą /pro15 - motd lange rodo geriausius 15 rekordus. Rekordams saugoti nvault arba sqlite (mySQL nenaudoju).
2. Žaidėjui surinkus 500000 taškų suteikti jam žalią prefix'ą - [Pro]. (pvz. [Pro]summerheat: blablabla)
3. Už kiekvieną nužudymą skirti 5000 taškų.
Svarbiausia būtų jei galėtumėte padaryti 1 punktą, nes aš pats neturiu jokio suvokimo kaip išsaugoti data.
Kitus punktus gal dar pats sugebėsiu
Mano editintas kodas:
[php]/* Plugin generated by AMXX-Studio */ #include <amxmodx>#include <amxmisc>#include <engine>#include <fakemeta>#include <hamsandwich>#include <fun>#include <cstrike>#include <colorchat> #define PLUGIN "Pro Surfers"#define VERSION "1.0"#define AUTHOR "Kia / Summerheat's edit" #define TASK_ID_LEFT 6492 // Prefix for Messages#define GAME_PREFIX "[ProSurfers]" // Points per Frame while Flying#define FLY_POINTS_PER_FRAME 0.003 // Points per Frame while Surfing#define SURF_POINTS_PER_FRAME 0.005 // Frequency of HUD being updated#define HUD_FREQ 0.1 // Points for playing Impressive Sound#define POINTS_IMPRESSIVE 10000 // Points for playing Perfect Sound#define POINTS_PERFECT 32000 // Points for playing Holy Shit Sound#define POINTS_HOLYSHIT 54000 // Points for playing Godlike Sound#define POINTS_WICKEDSICK 70000 // Points for playing Godlike Sound#define POINTS_GODLIKE 100000 // Comment if you don't want the points to be reseted after touching a teleport Entity#define RESET_ON_TP new Float:g_flTempFlyPoints[33]new Float:g_flTempSurfPoints[33]new Float:g_flTempTotalPoints[33]new Float:g_flTempAngle[33]new Float:g_flPreTempAngle[33] new Float:g_flPoints[33] new g_SyncObj2 new const szImpressive[] = "prosurfers/impressive.wav"new const szPerfect[] = "prosurfers/perfect.wav"new const szHolyShit[] = "prosurfers/holyshit.wav"new const szWickedsick[] = "prosurfers/wickedsick.wav"new const szGodlike[] = "prosurfers/godlike.wav" public plugin_precache() { precache_sound("ambience/particle_suck1.wav") precache_sound(szImpressive) precache_sound(szPerfect) precache_sound(szHolyShit) precache_sound(szWickedsick) precache_sound(szGodlike)} public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) /* HUD */ g_SyncObj2 = CreateHudSyncObj() /* Events */ register_event("DeathMsg", "Event_DeathMsg", "a") /* Hamsandwich */ RegisterHam(Ham_Spawn, "player", "func_HamSpawn", 1) #if defined RESET_ON_TP /* Touches */ RegisterHam(Ham_Touch, "trigger_teleport", "Touch_EntTouch") #endif} public client_putinserver(id){ g_flPoints[id] = 0.0 g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0 g_flTempAngle[id] = 0.0} public client_PreThink(id){ /* Angle */ new Float:flAngle[3] pev(id, pev_angles, flAngle) g_flPreTempAngle[id] = flAngle[1] /* Speed */ new Float:flVelocity[3] new Float:flSpeed pev(id, pev_velocity, flVelocity) flSpeed = vector_length(flVelocity) /* Origin */ new Float:origin[3], Float:dest[3]; entity_get_vector(id, EV_VEC_origin, origin); dest[0] = origin[0]; dest[1] = origin[1]; dest[2] = origin[2] - 1.0; /* TR */ new flags = entity_get_int(id, EV_INT_flags); new ptr = create_tr2(); engfunc(EngFunc_TraceHull, origin, dest, 0, flags & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, ptr); new Float:flFraction; get_tr2(ptr, TR_flFraction, flFraction); if( flFraction >= 1.0 ) { g_flTempFlyPoints[id] += FLY_POINTS_PER_FRAME * flSpeed free_tr2(ptr); } }public client_PostThink(id){ if(is_user_alive(id)) { new szMessage[256] /* Ground */ new flags = entity_get_int(id, EV_INT_flags); if( flags & FL_ONGROUND ) { if(g_flTempFlyPoints[id] > 0.0) g_flPoints[id] += g_flTempFlyPoints[id] if(g_flTempSurfPoints[id] > 0.0) g_flPoints[id] += g_flTempSurfPoints[id] if(g_flTempTotalPoints[id] > 0.0) g_flPoints[id] += (g_flTempFlyPoints[id] + g_flTempSurfPoints[id]) new iPoints = floatround(g_flTempFlyPoints[id] + g_flTempSurfPoints[id]) if(iPoints) check_for_sound(id, iPoints) g_flTempAngle[id] = 0.0 } /* Velocity */ new Float:flVelocity[3] new Float:flSpeed pev(id, pev_velocity, flVelocity) flSpeed = vector_length(flVelocity) /* HUD */ set_hudmessage(255, 255, 255, 0.45, 0.8, 0, _, HUD_FREQ, 0.0, 0.0, -1) if(IsUserSurfing(id)) { g_flTempSurfPoints[id] += SURF_POINTS_PER_FRAME * flSpeed } new szFlyHUD[64] formatex(szFlyHUD, charsmax(szFlyHUD), "^n^tFly points: +%i", floatround(g_flTempFlyPoints[id])) add(szMessage, charsmax(szMessage), szFlyHUD) new szSurfHUD[64] formatex(szSurfHUD, charsmax(szSurfHUD), "^n^tSurf points: +%i", floatround(g_flTempSurfPoints[id])) add(szMessage, charsmax(szMessage), szSurfHUD) new szTotalHUD[64] formatex(szTotalHUD, charsmax(szTotalHUD), "^n^tTotal points: +%i", floatround(g_flTempSurfPoints[id] + g_flTempFlyPoints[id])) add(szMessage, charsmax(szMessage), szTotalHUD) ShowSyncHudMsg(id, g_SyncObj2, szMessage) }} public check_for_sound(id, iPoints){ new szName[33] get_user_name(id, szName, charsmax(szName)) if(iPoints > POINTS_GODLIKE) { PlaySound(0, szGodlike) ColorChat(0, RED,"%s Godlike! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_WICKEDSICK) { PlaySound(0, szWickedsick) ColorChat(0, RED,"%s Wicked Sick! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_HOLYSHIT) { PlaySound(0, szHolyShit) ColorChat(0, BLUE,"%s Holy Shit! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_PERFECT) { PlaySound(0, szPerfect) ColorChat(0, GREEN,"%s Perfect! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_IMPRESSIVE) { PlaySound(0, szImpressive) ColorChat(0, GREY,"%s Impressive! %s collected %i points!", GAME_PREFIX, szName, iPoints) } g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0}public Touch_EntTouch(iEnt, id){ if(is_user_alive(id)) { g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0 }} public IsUserSurfing(id){ if( is_user_alive(id) ) { new flags = entity_get_int(id, EV_INT_flags); if( flags & FL_ONGROUND ) { return 0; } new Float:origin[3], Float:dest[3]; entity_get_vector(id, EV_VEC_origin, origin); dest[0] = origin[0]; dest[1] = origin[1]; dest[2] = origin[2] - 1.0; new ptr = create_tr2(); engfunc(EngFunc_TraceHull, origin, dest, 0, flags & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, ptr); new Float:flFraction; get_tr2(ptr, TR_flFraction, flFraction); if( flFraction >= 1.0 ) { free_tr2(ptr); return 0; } get_tr2(ptr, TR_vecPlaneNormal, dest); free_tr2(ptr); return dest[2] <= 0.7; } return 0} stock PlaySound(id, const sound[]){ if (equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id, "mp3 play ^"%s^"", sound) else client_cmd(id, "spk ^"%s^"", sound)}public print_color(id, cid, color, const message[], any:...){ new msg[192] vformat(msg, charsmax(msg), message, 5) /* //if you want to use ML, enable replace_all(msg, charsmax(msg), "!g", "^x04") replace_all(msg, charsmax(msg), "!n", "^x01") replace_all(msg, charsmax(msg), "!t", "^x03")*/ new param if (!cid) return else param = cid new team[32] get_user_team(param, team, 31) switch (color) { case 0: msg_teaminfo(param, team) case 1: msg_teaminfo(param, "TERRORIST") case 2: msg_teaminfo(param, "CT") case 3: msg_teaminfo(param, "SPECTATOR") } if (id) msg_saytext(id, param, msg) else msg_saytext(0, param, msg) if (color != 0) msg_teaminfo(param, team)} msg_saytext(id, cid, msg[]){ message_begin(id?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id) write_byte(cid) write_string(msg) message_end()} msg_teaminfo(id, team[]){ message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id) write_byte(id) write_string(team) message_end()} [/php]
Jei kam idomus originalus kodas, spausti čia.
Ačiū!
Reikia pagalbos pridedant keleta funkcijų į pluginą.
1. Pridėti komandą /pro15 - motd lange rodo geriausius 15 rekordus. Rekordams saugoti nvault arba sqlite (mySQL nenaudoju).
2. Žaidėjui surinkus 500000 taškų suteikti jam žalią prefix'ą - [Pro]. (pvz. [Pro]summerheat: blablabla)
3. Už kiekvieną nužudymą skirti 5000 taškų.
Svarbiausia būtų jei galėtumėte padaryti 1 punktą, nes aš pats neturiu jokio suvokimo kaip išsaugoti data.
Kitus punktus gal dar pats sugebėsiu

Mano editintas kodas:
[php]/* Plugin generated by AMXX-Studio */ #include <amxmodx>#include <amxmisc>#include <engine>#include <fakemeta>#include <hamsandwich>#include <fun>#include <cstrike>#include <colorchat> #define PLUGIN "Pro Surfers"#define VERSION "1.0"#define AUTHOR "Kia / Summerheat's edit" #define TASK_ID_LEFT 6492 // Prefix for Messages#define GAME_PREFIX "[ProSurfers]" // Points per Frame while Flying#define FLY_POINTS_PER_FRAME 0.003 // Points per Frame while Surfing#define SURF_POINTS_PER_FRAME 0.005 // Frequency of HUD being updated#define HUD_FREQ 0.1 // Points for playing Impressive Sound#define POINTS_IMPRESSIVE 10000 // Points for playing Perfect Sound#define POINTS_PERFECT 32000 // Points for playing Holy Shit Sound#define POINTS_HOLYSHIT 54000 // Points for playing Godlike Sound#define POINTS_WICKEDSICK 70000 // Points for playing Godlike Sound#define POINTS_GODLIKE 100000 // Comment if you don't want the points to be reseted after touching a teleport Entity#define RESET_ON_TP new Float:g_flTempFlyPoints[33]new Float:g_flTempSurfPoints[33]new Float:g_flTempTotalPoints[33]new Float:g_flTempAngle[33]new Float:g_flPreTempAngle[33] new Float:g_flPoints[33] new g_SyncObj2 new const szImpressive[] = "prosurfers/impressive.wav"new const szPerfect[] = "prosurfers/perfect.wav"new const szHolyShit[] = "prosurfers/holyshit.wav"new const szWickedsick[] = "prosurfers/wickedsick.wav"new const szGodlike[] = "prosurfers/godlike.wav" public plugin_precache() { precache_sound("ambience/particle_suck1.wav") precache_sound(szImpressive) precache_sound(szPerfect) precache_sound(szHolyShit) precache_sound(szWickedsick) precache_sound(szGodlike)} public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) /* HUD */ g_SyncObj2 = CreateHudSyncObj() /* Events */ register_event("DeathMsg", "Event_DeathMsg", "a") /* Hamsandwich */ RegisterHam(Ham_Spawn, "player", "func_HamSpawn", 1) #if defined RESET_ON_TP /* Touches */ RegisterHam(Ham_Touch, "trigger_teleport", "Touch_EntTouch") #endif} public client_putinserver(id){ g_flPoints[id] = 0.0 g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0 g_flTempAngle[id] = 0.0} public client_PreThink(id){ /* Angle */ new Float:flAngle[3] pev(id, pev_angles, flAngle) g_flPreTempAngle[id] = flAngle[1] /* Speed */ new Float:flVelocity[3] new Float:flSpeed pev(id, pev_velocity, flVelocity) flSpeed = vector_length(flVelocity) /* Origin */ new Float:origin[3], Float:dest[3]; entity_get_vector(id, EV_VEC_origin, origin); dest[0] = origin[0]; dest[1] = origin[1]; dest[2] = origin[2] - 1.0; /* TR */ new flags = entity_get_int(id, EV_INT_flags); new ptr = create_tr2(); engfunc(EngFunc_TraceHull, origin, dest, 0, flags & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, ptr); new Float:flFraction; get_tr2(ptr, TR_flFraction, flFraction); if( flFraction >= 1.0 ) { g_flTempFlyPoints[id] += FLY_POINTS_PER_FRAME * flSpeed free_tr2(ptr); } }public client_PostThink(id){ if(is_user_alive(id)) { new szMessage[256] /* Ground */ new flags = entity_get_int(id, EV_INT_flags); if( flags & FL_ONGROUND ) { if(g_flTempFlyPoints[id] > 0.0) g_flPoints[id] += g_flTempFlyPoints[id] if(g_flTempSurfPoints[id] > 0.0) g_flPoints[id] += g_flTempSurfPoints[id] if(g_flTempTotalPoints[id] > 0.0) g_flPoints[id] += (g_flTempFlyPoints[id] + g_flTempSurfPoints[id]) new iPoints = floatround(g_flTempFlyPoints[id] + g_flTempSurfPoints[id]) if(iPoints) check_for_sound(id, iPoints) g_flTempAngle[id] = 0.0 } /* Velocity */ new Float:flVelocity[3] new Float:flSpeed pev(id, pev_velocity, flVelocity) flSpeed = vector_length(flVelocity) /* HUD */ set_hudmessage(255, 255, 255, 0.45, 0.8, 0, _, HUD_FREQ, 0.0, 0.0, -1) if(IsUserSurfing(id)) { g_flTempSurfPoints[id] += SURF_POINTS_PER_FRAME * flSpeed } new szFlyHUD[64] formatex(szFlyHUD, charsmax(szFlyHUD), "^n^tFly points: +%i", floatround(g_flTempFlyPoints[id])) add(szMessage, charsmax(szMessage), szFlyHUD) new szSurfHUD[64] formatex(szSurfHUD, charsmax(szSurfHUD), "^n^tSurf points: +%i", floatround(g_flTempSurfPoints[id])) add(szMessage, charsmax(szMessage), szSurfHUD) new szTotalHUD[64] formatex(szTotalHUD, charsmax(szTotalHUD), "^n^tTotal points: +%i", floatround(g_flTempSurfPoints[id] + g_flTempFlyPoints[id])) add(szMessage, charsmax(szMessage), szTotalHUD) ShowSyncHudMsg(id, g_SyncObj2, szMessage) }} public check_for_sound(id, iPoints){ new szName[33] get_user_name(id, szName, charsmax(szName)) if(iPoints > POINTS_GODLIKE) { PlaySound(0, szGodlike) ColorChat(0, RED,"%s Godlike! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_WICKEDSICK) { PlaySound(0, szWickedsick) ColorChat(0, RED,"%s Wicked Sick! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_HOLYSHIT) { PlaySound(0, szHolyShit) ColorChat(0, BLUE,"%s Holy Shit! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_PERFECT) { PlaySound(0, szPerfect) ColorChat(0, GREEN,"%s Perfect! %s collected %i points!", GAME_PREFIX, szName, iPoints) } else if(iPoints > POINTS_IMPRESSIVE) { PlaySound(0, szImpressive) ColorChat(0, GREY,"%s Impressive! %s collected %i points!", GAME_PREFIX, szName, iPoints) } g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0}public Touch_EntTouch(iEnt, id){ if(is_user_alive(id)) { g_flTempFlyPoints[id] = 0.0 g_flTempSurfPoints[id] = 0.0 g_flTempTotalPoints[id] = 0.0 }} public IsUserSurfing(id){ if( is_user_alive(id) ) { new flags = entity_get_int(id, EV_INT_flags); if( flags & FL_ONGROUND ) { return 0; } new Float:origin[3], Float:dest[3]; entity_get_vector(id, EV_VEC_origin, origin); dest[0] = origin[0]; dest[1] = origin[1]; dest[2] = origin[2] - 1.0; new ptr = create_tr2(); engfunc(EngFunc_TraceHull, origin, dest, 0, flags & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, ptr); new Float:flFraction; get_tr2(ptr, TR_flFraction, flFraction); if( flFraction >= 1.0 ) { free_tr2(ptr); return 0; } get_tr2(ptr, TR_vecPlaneNormal, dest); free_tr2(ptr); return dest[2] <= 0.7; } return 0} stock PlaySound(id, const sound[]){ if (equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id, "mp3 play ^"%s^"", sound) else client_cmd(id, "spk ^"%s^"", sound)}public print_color(id, cid, color, const message[], any:...){ new msg[192] vformat(msg, charsmax(msg), message, 5) /* //if you want to use ML, enable replace_all(msg, charsmax(msg), "!g", "^x04") replace_all(msg, charsmax(msg), "!n", "^x01") replace_all(msg, charsmax(msg), "!t", "^x03")*/ new param if (!cid) return else param = cid new team[32] get_user_team(param, team, 31) switch (color) { case 0: msg_teaminfo(param, team) case 1: msg_teaminfo(param, "TERRORIST") case 2: msg_teaminfo(param, "CT") case 3: msg_teaminfo(param, "SPECTATOR") } if (id) msg_saytext(id, param, msg) else msg_saytext(0, param, msg) if (color != 0) msg_teaminfo(param, team)} msg_saytext(id, cid, msg[]){ message_begin(id?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id) write_byte(cid) write_string(msg) message_end()} msg_teaminfo(id, team[]){ message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id) write_byte(id) write_string(team) message_end()} [/php]
Jei kam idomus originalus kodas, spausti čia.
Ačiū!