Raised This Month: $ Target: $400
 0% 

Is this re-check necessary?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LagParty
Junior Member
Join Date: Jul 2008
Old 12-19-2008 , 18:32   Is this re-check necessary?
Reply With Quote #1

PHP Code:
if(!pev_valid(EntID[id]))//ent number for a player
        
EntID[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
    if(!
pev_valid(EntID[id])) //recheck if entity was created
        
return
//after this i will work with the entity 
thanks.
LagParty is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 12-19-2008 , 19:11   Re: Is this re-check necessary?
Reply With Quote #2

whats before if(!pev_valid(EntID[id]))//ent number for a player ? (First one)
And it depends what your doing afterwards, It never hurts to check if an entity is valid, because if it isn't and you mess with it, you probably will crash your server.
Styles is offline
Send a message via AIM to Styles
LagParty
Junior Member
Join Date: Jul 2008
Old 12-20-2008 , 00:21   Re: Is this re-check necessary?
Reply With Quote #3

ok, I'll keep the double check because i do a lot of stuff after.

Another question: i created an entity gave it a player model and when i drop it to the floor half of the body goes through it. I'm using fakemeta and i've been trying for HOURS to solve this problem. Any help will be appreciated.

PHP Code:
public MakeFrozenModel(id) {
    if(!
pev_valid(FrozenEntID[id]))
        
FrozenEntID[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
    if(!
pev_valid(FrozenEntID[id]))
        return
    static 
string[64], Float:Origin[3], Float:Angles[3], Float:Vel1[3], Float:Vel2[3], Model[16]
    
pev(id,pev_origin,Origin)
    
pev(id,pev_v_angle,Angles)
    
pev(id,pev_velocity,Vel1)
    
get_user_info(id,"model",Model,15)
    
    
//Store some info
    
set_pev(FrozenEntID[id],pev_classname,"freezemodel")
    
format(string,63,"models/player/%s/%s.mdl",Model,Model)
    
engfunc(EngFunc_SetModel,FrozenEntID[id],string)
    
    
    
set_pev(FrozenEntID[id],pev_size,{-16.0,-16.0,-36.0},{16.0,16.0,36.0})//mins,maxs
    
if(pev(id,pev_button)&IN_DUCKOrigin[2] += 18.0
    
else Origin[2] += 36.0
    
    set_pev
(FrozenEntID[id],pev_solid,SOLID_BBOX//some properties
    
set_pev(FrozenEntID[id],pev_movetype,MOVETYPE_TOSS)
    
    
set_pev(FrozenEntID[id],pev_sequence,pev(id,pev_sequence)) //give the correct anim type
    
    
engfunc(EngFunc_SetOrigin,FrozenEntID[id],Origin//Origin, view angle, velocity
    
set_pev(FrozenEntID[id],pev_v_angle,Angles)
    
velocity_by_aim(id,320,Vel2)
    
Vel1[0] += Vel2[0]
    
Vel1[1] += Vel2[1]
    
Vel1[2] += 32.0
    set_pev
(FrozenEntID[id],pev_velocity,Vel1)
    
    
set_pev(FrozenEntID[id],pev_framerate,1.0)
    
set_pev(FrozenEntID[id],pev_renderfx,kRenderFxGlowShell)
    
set_pev(FrozenEntID[id],pev_rendercolor,Float:{255.0,255.0,255.0}) //Add colour team later 
    
set_pev(FrozenEntID[id],pev_rendermode,kRenderNormal)  
    
set_pev(FrozenEntID[id],pev_renderamt,16.0)
    
    
//Give Weapon
    
if(!pev_valid(FrozenWeapID[id]))
        
FrozenWeapID[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
    if(!
pev_valid(FrozenWeapID[id]))
        return
    
set_pev(FrozenWeapID[id],pev_classname,"freezeweapon")
    
set_pev(FrozenWeapID[id],pev_solid,SOLID_NOT)
    
set_pev(FrozenWeapID[id],pev_aiment,FrozenEntID[id])
    
set_pev(FrozenWeapID[id],pev_movetype,MOVETYPE_FOLLOW)
    
get_weaponname(get_user_weapon(id),Model,15)
    if(
equal(Model,"weapon_mp5navy"))
        
format(Model,15,"weapon_mp5")
    
format(string,63,"models/p_%s.mdl",Model[7])
    
engfunc(EngFunc_SetModel,FrozenWeapID[id],string)
    
    
Origin[2] += 100.0//Testing pruposes
    
engfunc(EngFunc_SetOrigin,id,Origin)
    
    
set_pev(FrozenEntID[id],pev_nextthink,get_gametime()+0.01//Later use this one

thanks.
LagParty is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-20-2008 , 00:29   Re: Is this re-check necessary?
Reply With Quote #4

You didn't set ent's pev_maxs/pev_mins.
__________________

Community / No support through PM
danielkza is offline
LagParty
Junior Member
Join Date: Jul 2008
Old 12-20-2008 , 00:46   Re: Is this re-check necessary?
Reply With Quote #5

PHP Code:
set_pev(FrozenEntID[id],pev_size,{-16.0,-16.0,-36.0},{16.0,16.0,36.0})//mins,maxs 
That doesn't count?
LagParty is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-20-2008 , 00:50   Re: Is this re-check necessary?
Reply With Quote #6

Quote:
Originally Posted by LagParty View Post
PHP Code:
set_pev(FrozenEntID[id],pev_size,{-16.0,-16.0,-36.0},{16.0,16.0,36.0})//mins,maxs 
That doesn't count?
I don't think this is possible at all. You're passing two arrays, set_pev only accepts one int/float/array. It's probably error'ing and not doing anything.
__________________

Community / No support through PM
danielkza is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-20-2008 , 01:43   Re: Is this re-check necessary?
Reply With Quote #7

Code:
new Float:mins[3], Float:maxs[3]; // set mins and maxs engfunc(EngFunc_SetSize, entity, mins, maxs);
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
LagParty
Junior Member
Join Date: Jul 2008
Old 12-20-2008 , 03:18   Re: Is this re-check necessary?
Reply With Quote #8

Ok i got it. Setting pev_mins and pev_maxs helped with the entity not falling through the ground. Using EngFunc_SetSize helped with players passing through the entity (it was like SOLID_NOT).

Thanks to everyone for your help, i really appreciate it. Its frustrating to work a lot on your script and not getting any good results lol.
LagParty is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:11.


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