Raised This Month: $99 Target: $400
 24% 

how to set data to client..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JerryJerryAdios
Member
Join Date: Jun 2015
Location: the universe
Old 11-16-2016 , 22:43   how to set data to client..
Reply With Quote #1

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();

__________________
This is a Super Awesome Asking Guy! Don't mind alright? Just be cool!

Last edited by arne1288; 11-18-2016 at 01:28. Reason: Restored post
JerryJerryAdios is offline
Send a message via Skype™ to JerryJerryAdios
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 11-17-2016 , 02:17   Re: how to set data to client..
Reply With Quote #2

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();

__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this


www.unterwasserpyromanen.de

Last edited by Sillium; 11-17-2016 at 02:17.
Sillium is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-17-2016 , 21:22   Re: how to set data to client..
Reply With Quote #3

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".
__________________
WildCard65 is offline
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 04:18.


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