AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Metamod:Source Questions (https://forums.alliedmods.net/forumdisplay.php?f=74)
-   -   how to set data to client.. (https://forums.alliedmods.net/showthread.php?t=290569)

JerryJerryAdios 11-16-2016 22:43

how to set data to client..
 
i thought the code below should have worked... but it actually crashes the game.... is there anything wrong? Thank you!
PHP Code:

clientdata_t *pPlayer NULL;
pPlayer->health 20

PHP Code:

void testfx(void)
{
    
clientdata_t *pPlayer NULL;
    
pPlayer->health 20;
}

void HUD_Init(void)
{
    
gEngfuncs.pfnAddCommand("noooo"testfx);
    return 
gExportfuncs.HUD_Init();



Sillium 11-17-2016 02:17

Re: how to set data to client..
 
Don't blank your posts. If you have solved your problem it would be nice to know how you solved it so if someone has the same problem he can find a solution. -> https://forums.alliedmods.net/misc.php?do=showrules

Quote:

Originally Posted by JerryJerryAdios
i thought the code below should have worked... but it actually crashes the game.... is there anything wrong? Thank you!
PHP Code:

clientdata_t *pPlayer NULL;
pPlayer->health 20

PHP Code:

void testfx(void)
{
clientdata_t *pPlayer NULL;
pPlayer->health 20;
}

void HUD_Init(void)
{
gEngfuncs.pfnAddCommand("noooo"testfx);
return 
gExportfuncs.HUD_Init();




WildCard65 11-17-2016 21:22

Re: how to set data to client..
 
And I'll explain why your original snippet crashed: You were trying to set data at an invalid memory address (NULL aka 0x0 + offset of "health"), NULL is an invalid address meaning in lazy terms "No memory", don't confuse my lazy meaning with "Out of Memory".


All times are GMT -4. The time now is 16:04.

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