Raised This Month: $ Target: $400
 0% 

Something wrong with get_keyvalue() ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Votorx
Senior Member
Join Date: Jun 2004
Old 09-17-2004 , 19:36   Something wrong with get_keyvalue() ?
Reply With Quote #1

On an NS plugin Im trying to make, I create an entity with the classname "info_gameplay" afterwards I use DispatchKeyValue() to set certain properties to that entity, but when I use get_keyvalu() to find the value of the property I just modified it returns 0 meanwhile it should return 1 or 2. Is there something wrong with DIspatchKeyValue()? Or get_kayvalue()? Or could it just be my plugin?
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-17-2004 , 20:56  
Reply With Quote #2

DispatchKey's might not work in junction with get_keyvalue.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Votorx
Senior Member
Join Date: Jun 2004
Old 09-18-2004 , 16:27  
Reply With Quote #3

Why not? They are both 2 difference functions, they should be used interchangebly. I want to also note that I'm using Amxx .2 and when I create the ent, and use DispatchKeyValu() it doesn't seem to change that ent, maybe there's something wrong with DispatchKeyValue()
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-18-2004 , 20:20  
Reply With Quote #4

Did you use DispatchSpawn after keyvalue?
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-18-2004 , 20:54  
Reply With Quote #5

DispatchKeyValue, as far as I'm aware, is used for initializing an entity. Thus, it should only be used when creating a new entity. To edit existing entities, use entity_set_<type> and entity_get_<type>
Anpheus is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 09-18-2004 , 21:06  
Reply With Quote #6

No, Anpheus your thinking of DispatchSpawn(), and while your on the right track with the entity_set_<type> and entity_get_<type>, the properties I need to change aren't found and can't be used with the constants.

Twilight Suzuka, I'm using get_keyvalue after DispatchKeyValue().
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-18-2004 , 21:15  
Reply With Quote #7

No no NO! You have to use DispatchKeyValue, then DispatchSpawn. THEN the key values will be put into the ent. Not before.Not after. Ok...after, but not before. Damn it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Votorx
Senior Member
Join Date: Jun 2004
Old 09-18-2004 , 21:18  
Reply With Quote #8

Yeah that's what I'm doing >.>

Check it out :

Code:
 new iEnt = create_entity("info_gameplay") DispatchKeyValue(iEnt,"classname","info_gameplay") new value[1] = 100     new origin[32]     server_print("%d",value)     if(!is_valid_ent(iEnt)){         server_print("Invalid Ent")         return PLUGIN_HANDLED     }     get_keyvalue(iEnt, "teamone", value, 1)     if((value[0] <= Spectator) || (value[0] >= Unknown)){         client_print(id,print_chat,"Undefined Error")         get_keyvalue(iEnt, "teamone", value, 1)         server_print("%i",value)         get_keyvalue(iEnt, "teamtwo", value, 1)         server_print("%i",value)         new Teamchange[0] = 1         DispatchKeyValue(iEnt,"teamtwo",Teamchange)         server_print("%i",Teamchange)         DispatchKeyValue(iEnt,"teamone",Teamchange)         DispatchKeyValue(entity,"origin","8192 8192 8192")         server_print("%i",Teamchange)         DispatchSpawn(iEnt)         get_keyvalue(iEnt, "teamone", value, 1)         server_print("%i",value)         get_keyvalue(iEnt, "teamtwo", value, 1)         get_keyvalue(iEnt, "origin",origin,31)         server_print("%d",origin)         entity_set_string(iEnt, EV_SZ_classname, "info_gameplay")         server_print("%i",value)         server_print("End")         return PLUGIN_CONTINUE     }

If you look its like a before and after. I get the values of teamone and teamtwo after the ent was initiated, then I use DispatchKeyValue() to change around the properties, spawn it, then I get the values again. Only problem is its still returns zero when it should return 1.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Votorx
Senior Member
Join Date: Jun 2004
Old 09-20-2004 , 07:13  
Reply With Quote #9

So can anyone here help me or no?
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Votorx
Senior Member
Join Date: Jun 2004
Old 09-22-2004 , 13:12  
Reply With Quote #10

bumpness -.-
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
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 17:10.


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