AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I get one error, and I dont know why (https://forums.alliedmods.net/showthread.php?t=346)

knekter 03-19-2004 09:39

I get one error, and I dont know why
 
Theres 1 problem, but I cant figure it out, heres my code:

Code:
//////////////////////// #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> //////////////////////// new PlayerFx[33] //////////////////////// public plugin_init() {     register_plugin("Radom FX","0.1","Ashade")     register_clcmd("say /fx","GiveFx",0,": gives a random fx")     register_cvar("amx_fx","1")     register_logevent("StartRound",2,"1=Round_Start") } public StartRound() {     server_cmd("mp_freezetime 0")     new players[32], numberofplayers, i, cur_id     get_players(players,numberofplayers)     for (i=0;i<numberofplayers;i++)     {     cur_id = players[i]     PlayerFx[cur_id] = 0     }     return PLUGIN_HANDLED } public GiveFx(id) {     new name[33]     get_user_name(id,name,32)     if(get_cvar_num("amx_fx") != 1)     {         return PLUGIN_HANDLED     }     if(PlayerFx[id] == 1)     {         client_print(id,print_chat,"[AMX] You already have a random FX")     return PLUGIN_HANDLED     }     new RndFx = random_num(1,6)     if(PlayerFx[id] != 1)     {         if(RndFx == 1)         {         PlayerFx[id] = 1         set_user_gravity(id,0.5)         client_print(0,print_chat,"[AMX] %s has randomly been given low gravity",name)         return PLUGIN_HANDLED         }         if(RndFx == 2)     {         new pID[2]         pID[0] = id         PlayerFx[id] = 1         set_user_noclip(id,1)         client_print(0,print_chat,"[AMX] %s has randomly been given noclip for 10 sec.",name)         set_task(10.0,"stop_clip",0,pID,1)         return PLUGIN_CONTINUE         }         if(RndFx == 3)     {             PlayerFx[id] = 1         set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,50)             client_print(0,print_chat,"[AMX] %s has randomly been given transparency",name)             return PLUGIN_HANDLED         }     if(RndFx == 4)     {             PlayerFx[id] = 1         set_user_health(id,200)             client_print(0,print_chat,"[AMX] %s has randomly been given 200 hp",name)             return PLUGIN_HANDLED     }         if(RndFx == 5)     {         new pID[2]         pID[0] = id         PlayerFx[id] = 1             set_user_godmode(id,1)         client_print(0,print_chat,"[AMX] %s has randomly been given godmode for 10 sec.",name)         set_task(10.0,"stop_god",0,pID,1)         return PLUGIN_CONTINUE     }         if(RndFx == 6) && (cs_get_user_team(id) == "TERRORIST")     {         new pID[2]         pID[0] = id         PlayerFx[id] = 1             cs_set_user_model(id,"models\player\gign.mdl")         client_print(0,print_chat,"[AMX] %s has randomly had is player model changed for 10 sec.",name)         set_task(10.0,"stop_model",0,pID,1)         return PLUGIN_CONTINUE          }         if(RndFx == 6) && (cs_get_user_team(id) == "CT")     {         new pID[2]         pID[0] = id         PlayerFx[id] = 1             cs_set_user_model(id,"models\player\terror.mdl")         client_print(0,print_chat,"[AMX] %s has randomly had is player model changed for 10 sec.",name)         set_task(10.0,"stop_model",0,pID,1)         return PLUGIN_CONTINUE          }       return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public stop_clip(pID[0]) {     new name[33]     get_user_name(pID[0],name,32)     set_user_noclip(pID[0],0)     client_print(0,print_chat,"[AMX] Your 10 sec. of noclip are up %s",name)     return PLUGIN_HANDLED } public stop_god(pID[0]) {     new name[33]     get_user_name(pID[0],name,32)     set_user_godmode(pID[0],0)     client_print(0,print_chat,"[AMX] Your 10 sec. of noclip are up %s",name)     return PLUGIN_HANDLED } public stop_model(pID[0]) {     new name[33]     get_user_name(pID[0],name,32)     cs_reset_user_model(pID[0])     client_print(0,print_chat,"[AMX] Your 10 sec. of random model change are up %s",name)     return PLUGIN_HANDLED }

I dont think im using cs_get_user_team(id) correctly, plz HELP![/small]

BAILOPAN 03-19-2004 10:04

post the error, my eyes don't have a built in compiler

QwertyAccess 03-19-2004 10:45

LMAO

knekter 03-19-2004 11:01

Sry
 
sry about that:

Small compiler 2.1.0 Copyright (c) 1997-2002, ITB CompuPhase

Random_FX.sma(85) : error 029: invalid expression, assumed zero
Press any key to continue . . .

Geesu 03-19-2004 11:12

Wanna say what line 85 is? lol i don't feel like counting

knekter 03-19-2004 11:23

Line 85
 
Code:
if(RndFx == 6) && (cs_get_user_team(id) == "TERRORIST")
[/small]

PM 03-19-2004 11:34

shouldn't it be
Code:
if (RndFx = 6 && cs_get_user_team( id) = 1)

Geesu 03-19-2004 11:36

yep

If you do like a cs_get_user_team(id,name,31)

You can do

if(containi("TERRORIST",name)!=-1)

But it is much easier to do cs_get_user_team

Here are the numbers it returns:
#define SPEC 0
#define TEAM_T 1
#define TEAM_CT 2

knekter 03-19-2004 12:11

Nope, aintworking
 
It still doesnt work :( I defines TEAM_T and such, then I did if(cs_get_user_team(id)==1) and it still wotn work, I get these errors:

Small compiler 2.1.0 Copyright (c) 1997-2002, ITB CompuPhase

Random_FX.sma(89) : error 029: invalid expression, assumed zero
Random_FX.sma(89 -- 90) : error 029: invalid expression, assumed zero
Random_FX.sma(99) : error 029: invalid expression, assumed zero
Random_FX.sma(99 -- 100) : error 029: invalid expression, assumed zero

4 Errors.
Press any key to continue . . .

the same spot as before :(

knekter 03-19-2004 12:13

WOW
 
nvm, I used amxer's idea and it fixed :oops: lol, thx again!


All times are GMT -4. The time now is 23:42.

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