Raised This Month: $32 Target: $400
 8% 

Bintools with string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 12-04-2016 , 18:12   Bintools with string
Reply With Quote #1

I want to create function
PHP Code:
UTIL_SetModel(CPlayer->pEntity"path to precached model"); 
With apply model for the player, so i have code, which reads offets from .games.txt

PHP Code:
/** SETENTITYMODEL */
    
g_pZombieConfig->GetOffset("SetEntityModel", &offset);
    
pass[0].flags PASSFLAG_BYVAL;
    
pass[0].size sizeof(char*);
    
pass[0].type PassType_Basic;
    
g_pSetEntityModel bintools->CreateVCall(offset00NULLpass1);
    
g_CallWrappers.push_back(g_pSetEntityModel); 
And i want to create function, which will apply model
But that code bellow, don't work and crash server
Somebody can help me?
PHP Code:
/**
 * @brief Set the player model.
 *
 * @param pEntity    The entity index.
 * @param sModel    The path to the player model.
 **/
void UTIL_SetModel(CBaseEntity *pEntitychar *sModel)
{
    
unsigned char vstk[sizeof(CBaseEntity *) + sizeof(char *)];
    
unsigned char *vptr vstk;
    
    *(
CBaseEntity **)vptr pEntity;
    
vptr += sizeof(CBaseEntity *);
    *(
char *)vptr = *sModel;
    
    
// Set the player model
    
g_pSetEntityModel->Execute(vstkNULL);


For example if i use that method to pass boolean, it work great
Spoiler
__________________

Last edited by gubka; 12-04-2016 at 18:13.
gubka is offline
Send a message via ICQ to gubka
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 12-04-2016 , 19:44   Re: Bintools with string
Reply With Quote #2

Solved
char * -> void *
__________________
gubka is offline
Send a message via ICQ to gubka
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 12-07-2016 , 14:21   Re: Bintools with string
Reply With Quote #3

There are some other examples: https://wiki.alliedmods.net/Virtual_..._(Source_Mods)
Though, they do not look so succinctly.

Last edited by kadet.89; 12-07-2016 at 14:31.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Reply


Thread Tools
Display Modes

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 16:19.


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