AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Basic Lj stats help. (https://forums.alliedmods.net/showthread.php?t=86960)

{PHILMAGROIN} 03-04-2009 21:47

Basic Lj stats help.
 
I got this basic lj stats from kz monkeys site. and I have been deleting code just trying to get very basic jump distance. I have it to where it compiles fine with no errors but there is no stats showing. its probably something simple but i have no idea and was wondering if someone could help here is the code

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #pragma semicolon 1 #define FAST_SERVER // Boo new bool:gInAir[33]; new const gPLUGIN[] = "ljstats"; new const gVERSION[] = "0.1"; new const gAUTHOR[] = "Fatalis"; public plugin_init() {     register_plugin(gPLUGIN, gVERSION, gAUTHOR);         register_cvar(gPLUGIN, gVERSION, FCVAR_SERVER);         register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0);     register_forward(FM_Touch, "fwdTouch", 0); } public fwdPlayerPreThink(id) {     if( is_user_alive(id) )     {         static Float:vJumpedAt[33][3];         static Float:vOrigin[3];         static Float:vAngles[3];         static Float:vTraceEnd[3];         static Float:vVelocity[3];                 pev(id, pev_velocity, vVelocity);             if( gInAir[id] == true )         {                 if( pev(id, pev_button)&IN_JUMP         && pev(id, pev_flags)&FL_ONGROUND         && gInAir[id] == false)         {             gInAir[id] = true;                         pev(id, pev_origin, vOrigin);                         vOrigin[2]-=36.0;                         pev(id, pev_v_angle, vAngles);                         vOrigin[0]-=16.0*floatcos(vAngles[1], degrees);             vOrigin[1]-=16.0*floatsin(vAngles[1], degrees);                         vJumpedAt[id][0] = vOrigin[0];             vJumpedAt[id][1] = vOrigin[1];             vJumpedAt[id][2] = vOrigin[2];         }         else if( pev(id, pev_flags)&FL_ONGROUND && gInAir[id] == true )         {             gInAir[id] = false;                         pev(id, pev_origin, vOrigin);             pev(id, pev_v_angle, vAngles);                         vOrigin[0]+=16.0*floatcos(vAngles[1], degrees);             vOrigin[1]+=16.0*floatsin(vAngles[1], degrees);                         vTraceEnd[0] = vOrigin[0];             vTraceEnd[1] = vOrigin[1];             vTraceEnd[2] = vOrigin[2];             vTraceEnd[2]-=64.0;                         static Float:vLandedAt[3];             fm_trace_line(id, vOrigin, vTraceEnd, vLandedAt);                         static Float:fDistance;             fDistance = get_distance_f(vJumpedAt[id], vLandedAt);                         if( vJumpedAt[id][2] == vLandedAt[2] && fDistance > 210.0 )             {                 client_print(id, print_chat, "distance: %f", fDistance);                                     }             }         }     }         return FMRES_IGNORED; } fm_trace_line(ignoreEnt, const Float:vStart[3], const Float:vEnd[3], Float:vRet[3]) {     engfunc(EngFunc_TraceLine, vStart, vEnd, ignoreEnt == -1 ? 1 : 0, ignoreEnt);     new ent = global_get(glb_trace_ent);     global_get(glb_trace_endpos, vRet);     return pev_valid(ent) ? ent : 0; }

Exolent[jNr] 03-05-2009 21:59

Re: Basic Lj stats help.
 
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #pragma semicolon 1 // Boo new bool:gInAir[33]; new const gPLUGIN[] = "ljstats"; new const gVERSION[] = "0.1"; new const gAUTHOR[] = "Fatalis"; public plugin_init() {     register_plugin(gPLUGIN, gVERSION, gAUTHOR);         register_cvar(gPLUGIN, gVERSION, FCVAR_SERVER);         register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0); } public fwdPlayerPreThink(id) {     if( is_user_alive(id) )     {         static Float:vJumpedAt[33][3];         static Float:vOrigin[3];         static Float:vAngles[3];         static Float:vTraceEnd[3];                 if( pev(id, pev_button)&IN_JUMP         && pev(id, pev_flags)&FL_ONGROUND         && gInAir[id] == false)         {             gInAir[id] = true;                         pev(id, pev_origin, vOrigin);                         vOrigin[2]-=36.0;                         pev(id, pev_v_angle, vAngles);                         vOrigin[0]-=16.0*floatcos(vAngles[1], degrees);             vOrigin[1]-=16.0*floatsin(vAngles[1], degrees);                         vJumpedAt[id][0] = vOrigin[0];             vJumpedAt[id][1] = vOrigin[1];             vJumpedAt[id][2] = vOrigin[2];         }         else if( pev(id, pev_flags)&FL_ONGROUND && gInAir[id] == true )         {             gInAir[id] = false;                         pev(id, pev_origin, vOrigin);             pev(id, pev_v_angle, vAngles);                         vOrigin[0]+=16.0*floatcos(vAngles[1], degrees);             vOrigin[1]+=16.0*floatsin(vAngles[1], degrees);                         vTraceEnd[0] = vOrigin[0];             vTraceEnd[1] = vOrigin[1];             vTraceEnd[2] = vOrigin[2];             vTraceEnd[2]-=64.0;                         static Float:vLandedAt[3];             fm_trace_line(id, vOrigin, vTraceEnd, vLandedAt);                         static Float:fDistance;             fDistance = get_distance_f(vJumpedAt[id], vLandedAt);                         if( vJumpedAt[id][2] == vLandedAt[2] && fDistance > 210.0 )             {                     client_print(id, print_chat, "distance: %f", fDistance);             }         }     }         return FMRES_IGNORED; } fm_trace_line(ignoreEnt, const Float:vStart[3], const Float:vEnd[3], Float:vRet[3]) {     engfunc(EngFunc_TraceLine, vStart, vEnd, ignoreEnt == -1 ? 1 : 0, ignoreEnt);     new ent = global_get(glb_trace_ent);     global_get(glb_trace_endpos, vRet);     return pev_valid(ent) ? ent : 0; }

Okay, code is fixed, but there will still be bugs in the stats, such as cheating with noclip, ladders, teleports, etc.

{PHILMAGROIN} 03-05-2009 22:05

Re: Basic Lj stats help.
 
thats how i want it thanks!


All times are GMT -4. The time now is 17:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.