Raised This Month: $100 Target: $400

Copyback Vector

Post New Thread Reply   
Thread Tools Display Modes
Author Message
AlliedModders Donor
Join Date: Dec 2010
Location: Russia
Old 11-18-2018 , 10:03   Copyback Vector
Reply With Quote #1

Hello. I am trying to call a function that, after executing get a position in a variable:
PHP Code:
cell_t L4D2_GetRandomSpawnPosition(IPluginContext *pContext, const cell_t *params)
    if (
g_pZombieManager == NULL)
pContext->ThrowNativeError("ZombieManager unsupported or not available; file a bug report");

ICallWrapper *pWrapper NULL;

    if (!
PassInfo pass[4]; \
pass[0].flags PASSFLAG_BYVAL; \
pass[0].size sizeof(ZombieClassType); \
pass[0].type PassType_Basic; \
pass[1].flags PASSFLAG_BYVAL; \
pass[1].size sizeof(int); \
pass[1].type PassType_Basic; \
pass[2].flags PASSFLAG_BYVAL; \
pass[2].size sizeof(CBaseEntity *); \
pass[2].type PassType_Basic; \
pass[3].flags PASSFLAG_BYVAL; \
pass[3].size sizeof(Vector*); \
pass[3].type PassType_Basic; \
pWrapper g_pBinTools->CreateCall(addrCallConv_ThisCallNULLpass4));

int client params[3];
CBaseEntity pClient NULL;
    if (
client != -1)
pClient UTIL_GetCBaseEntity(clienttrue);
pClient == NULL
pContext->ThrowNativeError("Invalid client entity");        

Vector vector;
vector[0] = sp_ctof(0.0);
vector[1] = sp_ctof(0.0);
vector[2] = sp_ctof(0.0);

unsigned char vstksizeof(void*) + sizeof(ZombieClassType) + sizeof(int) + sizeof(CBaseEntity *) + sizeof(Vector*) ];
unsigned char *vptr vstk;

void **)vptr g_pZombieManager;
vptr += sizeof(void *);
cell_t*)vptr params[1];
vptr += sizeof(ZombieClassType);

int *)vptr params[2];
vptr += sizeof(int *);

CBaseEntity **)vptr pClient;
vptr += sizeof(CBaseEntity *);

Vector**)vptr = &vector;


void *buffer = (const unsigned char *)vstk pWrapper->GetParamInfo(3)->offset;

Vector *NULL;
= *(Vector**)buffer;

pContext->LocalToPhysAddr(params[4], &addr);


It works in linux, but in windows I get a server crash on pWrapper->Execute(vstk, NULL);... How can I assign a different solution so that after the call, the function returns an updated variable (like for example VENCODE_FLAG_COPYBACK in sdktools)?

Last edited by Accelerator74; 11-18-2018 at 10:07.
Accelerator74 is offline
Send a message via ICQ to Accelerator74
Veteran Member
Join Date: Jan 2012
Location: Dublin
Old 12-20-2018 , 05:39   Re: Copyback Vector
Reply With Quote #2

Like i uderstand, some calls like even Terminate require some __asm work, maybe the issue in that particular function is similar?
gubka is offline
Send a message via ICQ to gubka Send a message via Skype™ to gubka

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 13:02.

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