AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Something wrong with get_keyvalue() ? (https://forums.alliedmods.net/showthread.php?t=5954)

Votorx 09-17-2004 19:36

Something wrong with get_keyvalue() ?
 
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?

Twilight Suzuka 09-17-2004 20:56

DispatchKey's might not work in junction with get_keyvalue.

Votorx 09-18-2004 16:27

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

Twilight Suzuka 09-18-2004 20:20

Did you use DispatchSpawn after keyvalue?

Anpheus 09-18-2004 20:54

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>

Votorx 09-18-2004 21:06

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

Twilight Suzuka 09-18-2004 21:15

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.

Votorx 09-18-2004 21:18

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.

Votorx 09-20-2004 07:13

So can anyone here help me or no?

Votorx 09-22-2004 13:12

bumpness -.-


All times are GMT -4. The time now is 17:10.

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