AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Tag mismatch, problem with variable (https://forums.alliedmods.net/showthread.php?t=100817)

xbatista 08-18-2009 07:59

Tag mismatch, problem with variable
 
PHP Code:

new const g_color[][] = { {0,40,40},{190,255,120} }; 

PHP Code:

new random_color random(sizeof(g_color))
fm_set_kvd(ent"rendercolor"random_color"env_fog"

PHP Code:

stock fm_set_kvd(entity, const key[], const value[], const className[] = "") {
    if (
className[0]) 
        
set_kvd(0KV_ClassNameclassName)
    else 
    {
        new class[
32]
        
pev(entitypev_classname, class, sizeof class - 1)
        
set_kvd(0KV_ClassName, class)
    }

    
set_kvd(0KV_KeyNamekey)
    
set_kvd(0KV_Valuevalue)
    
set_kvd(0KV_fHandled0)

    return 
dllfunc(DLLFunc_KeyValueentity0)


Tag mismatch 3, on this line :
PHP Code:

fm_set_kvd(ent"rendercolor"random_color"env_fog"

:crab: :mrgreen:

alan_el_more 08-18-2009 08:07

Re: Tag mismatch, problem with variable
 
PHP Code:

new random_color g_color[random_num(0sizeof(g_color) - 1)] 


xbatista 08-18-2009 08:11

Re: Tag mismatch, problem with variable
 
Already tryied, array must be indexed etc...

xbatista 08-18-2009 08:14

Re: Tag mismatch, problem with variable
 
ahhrrr was a problem , now look at it and it works :D
PHP Code:

fm_set_kvd(ent"rendercolor"g_color[random_num(0sizeof(g_color) - 1)], "env_fog"


Arkshine 08-18-2009 08:32

Re: Tag mismatch, problem with variable
 
It can't work. You need a STRING, something like "0 40 40". What you have done is wrong.

xbatista 08-18-2009 09:26

Re: Tag mismatch, problem with variable
 
yea I tested I thought that was good, but it mixes 2 colors together :0

hleV 08-18-2009 18:41

Re: Tag mismatch, problem with variable
 
Code:
new const g_color[][] = {     "0 40 40",     "190 255 120" };
Code:
new random_color = random(sizeof(g_color)) fm_set_kvd(ent, "rendercolor", g_color[random_color], "env_fog")

Exolent[jNr] 08-18-2009 19:58

Re: Tag mismatch, problem with variable
 
Quote:

Originally Posted by phoenix120 (Post 904968)
it's easy :)

new g_color[][] = { {1,2,3},{4,5,6} };

g_color[0] <- we want first array of values
g_color[0][0] <-we want first value from first array = 1
g_color[1][0] <-we want first value from second array = 4
etc...

g_color[index of array][value from array]

i hope you will understand this :wink:

That has nothing to do with the thread.

xbatista 08-19-2009 04:46

Re: Tag mismatch, problem with variable
 
Quote:

Originally Posted by hleV (Post 904910)
Code:
new const g_color[][] = {     "0 40 40",     "190 255 120" };
Code:
new random_color = random(sizeof(g_color)) fm_set_kvd(ent, "rendercolor", g_color[random_color], "env_fog")

Thanks will try it
EDIT: That worked

xbatista 08-19-2009 04:51

Re: Tag mismatch, problem with variable
 
Is it possible to put fog in plugin_init to work, cuz I've tryied and that not works, but maybe there are way to do it? I don't want use it in plugin_precache ?


All times are GMT -4. The time now is 15:13.

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