Raised This Month: $ Target: $400
 0% 

fakemeta's set_pev crash server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-12-2012 , 14:11   fakemeta's set_pev crash server
Reply With Quote #1

Ok....so in my plugin i have a skin and originally i used engine entity_set_string() but Connor told me to use fakemeta's set_pev here....
http://forums.alliedmods.net/showpos...2&postcount=11

now....i either did it wrong, misunderstood his post, or it is just an incorrect concept. Either way...i need this fixed.

This is what i did:
PHP Code:
// globals
new g_allocPmodg_allocVmod    // model Handles

// plugin_init
g_allocPmod engfunc(EngFunc_AllocString"model/p_bknuckles.mdl")
    
g_allocVmod engfunc(EngFunc_AllocString"model/v_bknuckles.mdl")

// show_model
        
set_pev(idpev_viewmodelg_allocVmod)
        
set_pev(idpev_weaponmodelg_allocPmod)

// This was my original code (that works fine)
entity_set_string(idEV_SZ_viewmodel"models/v_bknuckles.mdl")
entity_set_string(idEV_SZ_weaponmodel"models/p_bknuckles.mdl"
can someone tell me what's going on here? I read the includes, stocks, and const files for fakemeta and it didn't tell me anything, realy.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-12-2012 at 14:17.
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-12-2012 , 16:55   Re: fakemeta's set_pev crash server
Reply With Quote #2

Code is ok, you may have made an error somewhere else.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-12-2012 , 17:35   Re: fakemeta's set_pev crash server
Reply With Quote #3

You forgot the "s" in "models" for your model path.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-12-2012 , 17:38   Re: fakemeta's set_pev crash server
Reply With Quote #4

Oh lol !!!


That wouldn't have happened if you had do :

new const g_szModel[] = "models/p_bknuckles.mdl"

..

precache_model( g_szModel )

..

g_iAlloc = engfunc(EngFunc_AllocString, g_szModel)


And doing this you save again some memory.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-12-2012 , 18:39   Re: fakemeta's set_pev crash server
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
You forgot the "s" in "models" for your model path.
LOL! much thanks....


Quote:
Originally Posted by ConnorMcLeod View Post
Oh lol !!!


That wouldn't have happened if you had do :

new const g_szModel[] = "models/p_bknuckles.mdl"

..

precache_model( g_szModel )

..

g_iAlloc = engfunc(EngFunc_AllocString, g_szModel)


And doing this you save again some memory.
Now....how would that save memory? You're adding extra variables to the globe.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-12-2012 at 20:13.
Liverwiz is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-13-2012 , 00:00   Re: fakemeta's set_pev crash server
Reply With Quote #6

Quote:
Originally Posted by Liverwiz View Post
LOL! much thanks....




Now....how would that save memory? You're adding extra variables to the globe.
is not a extra variables, its a unique variable...

Your original code has multiple constants.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-13-2012 at 00:06. Reason: Ops: Your original code has multiple 'constants'
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 06-13-2012 , 03:56   Re: fakemeta's set_pev crash server
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
And doing this you save again some memory.
Sorry for offtopic.

For example I have this:
PHP Code:
public plugin_precache()
{
    
precache_model"models/w_MyModel.mdl" )
}

public 
Fm_SetModelentmodel[ ] )
{
    [...]
    
engfuncEngFunc_SetModelent"models/w_MyModel.mdl" )

and If I use:

PHP Code:
new const g_szWorldModel[ ] = "models/w_MyModel.mdl"

public plugin_precache()
{
    
precache_modelg_szWorldModel )
}

public 
Fm_SetModelentmodel[ ] )
{
    [...]
    
engfuncEngFunc_SetModelentg_szWorldModel )

will clean a bit of memory ? On world model is not necessary to AllocString, right ?

Last edited by dFF; 06-13-2012 at 03:57.
dFF is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-13-2012 , 05:06   Re: fakemeta's set_pev crash server
Reply With Quote #8

Yes and yes.
__________________
Arkshine is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 06-13-2012 , 05:14   Re: fakemeta's set_pev crash server
Reply With Quote #9

Ok, thanks and thanks .
dFF is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-13-2012 , 11:56   Re: fakemeta's set_pev crash server
Reply With Quote #10

So this would be the best way to do it, yes?
Sorry to get redundant with questions, i'm having a mid-life crisis and just ran out of weed.

PHP Code:
// globals 
new g_allocPmodg_allocVmod    // model Handles 
static const szg_Pbk[] = "models/p_bknuckles.mdl"
static const szg_Vbk[] = "models/v_bknuckles.mdl"

// plugin_init 
g_allocPmod engfunc(EngFunc_AllocStringszg_Pbk//"model/p_bknuckles.mdl") 
    
g_allocVmod engfunc(EngFunc_AllocStringszg_Vbk//"model/v_bknuckles.mdl") 

// show_model 
        
set_pev(idpev_viewmodelg_allocVmod
        
set_pev(idpev_weaponmodelg_allocPmod

// This was my original code (that works fine) 
entity_set_string(idEV_SZ_viewmodel"models/v_bknuckles.mdl"
entity_set_string(idEV_SZ_weaponmodel"models/p_bknuckles.mdl"
or do i skip the EngFunc_AllocString part and just use set_pev(id, pev_viewmodel, szg_Vbk)
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 06:07.


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