Raised This Month: $ Target: $400
 0% 

errors compiling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-03-2006 , 16:16   errors compiling
Reply With Quote #1

problem
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <tsfun> #include <engine> #define PLUGIN "New Plug-In" #define VERSION "beta1" #define AUTHOR "wonsae" new bool:has_headache[33] new bool:has_cold[33] new bool:has_flu[33] new oldspeed = 320 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         set_task(1.0,"sick",0,"",0,"b" )     register_srvcmd("item_aspiren","item_aspiren")     register_srvcmd("item_needle","item_needle")     register_srvcmd("item_medicine","item_medicine")     register_concmd("amx_sick","adminsick",ADMIN_KICK,"amx_sick <name> <type>") } public client_connect(id){     has_cold[id] = false     has_flu[id] = false     has_headache[id] = false     client_cmd(id,"cl_realhud 1") } public health(id){     if(get_user_health(id) > 100){         client_print(id,print_chat,"[RealMod] You feel awesome!")     }     if(get_user_health(id) > 85){         client_print(id,print_chat,"[RealMod] You feel ok")     }     if(get_user_health(id) > 60){         client_print(id,print_chat,"[RealMod] You feel horrible")     }     if(get_user_health(id) > 45){         client_print(id,print_chat,"[RealMod] You feel like dying")     }     if(get_user_health(id) > 20){         client_print(id,print_chat,"[RealMod] You're breathing heavily and you're losing air")     }     if(get_user_health(id) > 5){         client_print(id,print_chat,"[RealMod] Your dying!")         set_task(1.0,"dying",0,"",0,"b" )     }     return PLUGIN_HANDLED } public dying(id){     new hp = get_user_health(id)     set_user_health(id,hp - 1) } public slots(id){     new clip, ammo     new slot = ts_getuserslots(id)     if(get_user_weapon(id,clip,ammo)){         client_print(id,print_chat,"[RealMod] You have %i amount of slots left",slot)     }     return PLUGIN_HANDLED } public ammo(id){     new ammo1, clip, weapon     get_user_ammo(id,weapon,clip,ammo1)     client_print(id,print_chat,"[RealMod] You have about %i ammo and %i clip left",ammo1, clip) } public sick(id){     if(has_headache[id] == false){         if(random_num(0,100)){             has_headache[id] = true         }     }     if(has_headache[id] == true){         set_user_rendering(id,kRenderFxGlowShell,255,42,0,kRenderNormal,16)         client_cmd(id,"cl_forwardspeed 250;cl_backspeed 250;cl_sidespeed 250")         client_print(id,print_chat,"[RealMod] You have a bad headache!")         return PLUGIN_HANDLED     }     if(has_cold[id] == false){         if(random_num(0,200)){             has_cold[id] = true         }     }     if(has_cold[id] == true){         set_user_rendering(id,kRenderFxGlowShell,255,42,0,kRenderNormal,16)         client_cmd(id,"cl_forwardspeed 150;cl_backspeed 150;cl_sidespeed 150")         client_print(id,print_chat,"[RealMod] You're becoming very cold!")         client_print(id,print_chat,"[RealMod] You started to get a cold! Find a doctor quickly!")         return PLUGIN_HANDLED     }     if(has_flu[id] == false){         if(random_num(0,300)){             has_flu[id] = true         }     }     if(has_flu[id] == true){         set_user_rendering(id,kRenderFxGlowShell,255,42,0,kRenderNormal,16)         client_cmd(id,"cl_forwardspeed 100;cl_backspeed 100;cl_sidespeed 100")         client_print(id,print_chat,"[RealMod] You're becoming very cold and weak")         client_print(id,print_chat,"[RealMod] You started to get a flu! Find a doctor quickly!")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public client_disconnect(id){     has_cold[id] = false     has_flu[id] = false     has_headache[id] = false     set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)     client_cmd(id,"cl_forwardspeed %i;cl_backspeed %i;cl_sidespeed %i",oldspeed,oldspeed,oldspeed) } public client_PreThink(id){     client_cmd(id,"cl_realhud 1")     return PLUGIN_CONTINUE } public item_aspiren(){     new arg[33], id     read_argv(1,arg,32)     id = str_to_num(arg)     has_headache[id] = false     set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)     client_print(id,print_chat,"[RealMod] You feel much better now!")     client_cmd(id,"cl_forwardspeed %i;cl_backspeed %i;cl_sidespeed %i",oldspeed,oldspeed,oldspeed)     return PLUGIN_HANDLED } public item_medicine(){     new arg[33], id     read_argv(1,arg,32)     id = str_to_num(arg)     if(random_num(0,20)){         has_cold[id] = false         has_flu[id] = false         has_headache[id] = false         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)         client_print(id,print_chat,"[RealMod] You feel alot better now!")         client_cmd(id,"cl_forwardspeed %i;cl_backspeed %i;cl_sidespeed %i",oldspeed,oldspeed,oldspeed)     }     client_print(id,print_chat,"[RealMod] The medicine didn't do anything!")     return PLUGIN_HANDLED } public item_needle(){     new arg[33], arg2[33], id, targetid     read_argv(1,arg,32)     read_argv(2,arg2,32)     id = str_to_num(arg)     if(!is_user_alive(targetid)) return PLUGIN_HANDLED     if(is_user_connected(targetid)) return PLUGIN_HANDLED     if(random_num(0,10)){         has_cold[id] = false         has_flu[id] = false         has_headache[id] = false         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)         client_print(id,print_chat,"[RealMod] You feel alot better now!")         client_cmd(id,"cl_forwardspeed %i;cl_backspeed %i;cl_sidespeed %i",oldspeed,oldspeed,oldspeed)     }     client_print(id,print_chat,"[RealMod] The needle didn't do anything!")     return PLUGIN_HANDLED } public adminsick(id){     new arg[33], arg2[33], name, sickness     read_argv(1,arg,32)     read_argv(2,arg2,32)     name = str_to_num(arg)     sickness = str_to_num(arg2)     get_user_name(id,name,32)     if(!is_user_alive(name)) return PLUGIN_HANDLED     if(is_user_connected(name)) return PLUGIN_HANDLED     if(sickness[id] == cold){         has_cold[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == flu){         has_flu[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == headache){         has_headache[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     return PLUGIN_HANDLED }

errors are
Code:
Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 2) on line 182
Error: Invalid subscript (not an array or too many subscripts): "sickness" on line 185
Warning: Expression has no effect on line 185
Error: Expected token: ";", but found "]" on line 185
Error: Invalid expression, assumed zero on line 185
Error: Too many error messages on one line on line 185

Compilation aborted.
5 Errors.
Could not locate output file C:\Documents and Settings\c\My Documents\Program Files\plugins\Untitled.amx (compile failed).
help please
wonsae is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-03-2006 , 16:41  
Reply With Quote #2

Code:
public adminsick(id){     new arg[33], arg2[33], name, sickness[33]     read_argv(1,arg,32)     read_argv(2,arg2,32)     name = str_to_num(arg)     sickness = str_to_num(arg2)     get_user_name(id,name,32)     if(!is_user_alive(name)) return PLUGIN_HANDLED     if(is_user_connected(name)) return PLUGIN_HANDLED     if(sickness[id] == cold){         has_cold[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == flu){         has_flu[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == headache){         has_headache[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     return PLUGIN_HANDLED }

You forgot to make variable sickness an array :/
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-03-2006 , 16:55  
Reply With Quote #3

I still get errors

Code:
public adminsick(id){     new arg[33], arg2[33], name, sickness[33]     read_argv(1,arg,32)     read_argv(2,arg2,32)     name = str_to_num(arg)     get_user_name(id,arg,32)     if(!is_user_alive(name)) return PLUGIN_HANDLED     if(is_user_connected(name)) return PLUGIN_HANDLED     if(sickness[id] == cold){         has_cold[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == flu){         has_flu[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(sickness[id] == headache){         has_headache[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     return PLUGIN_HANDLED }

I defined flu,cold, and headache

Code:
#define cold "cold" #define headache "headache" #define flu "flu"

but i still get this
Code:
Welcome to the AMX Mod X 1.70-300 Compiler. Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team Error: Array must be indexed (variable "-unknown-") on line 187 Error: Array must be indexed (variable "-unknown-") on line 191 Error: Array must be indexed (variable "-unknown-") on line 195 3 Errors. Could not locate output file C:\Documents and Settings\c\My Documents\Program Files\plugins\realmod.amx (compile failed).
wonsae is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-03-2006 , 17:03  
Reply With Quote #4

Code:
public adminsick(id){       new arg[33], arg2[33], name, sickness[33]       read_argv(1,arg,32)       read_argv(2,arg2,32)       name = str_to_num(arg)       sickness[id] = str_to_num(arg2)       get_user_name(id,name,32)       if(!is_user_alive(name)) return PLUGIN_HANDLED       if(is_user_connected(name)) return PLUGIN_HANDLED       if(sickness[id] == cold){           has_cold[name] = true           client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness[id)       }       if(sickness[id] == flu){           has_flu[name] = true           client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness[id])       }       if(sickness[id] == headache){           has_headache[name] = true           client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness[id])       }       return PLUGIN_HANDLED   }

Try that

What I dont get though is why you use str_to_num() assigned to sickness but yet you compare it to a string.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-03-2006 , 17:16  
Reply With Quote #5

Zenith77 just stop.
You can't compare strings with == you have to use the string functions
equal() equali() contain() and containi()
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-03-2006 , 17:31  
Reply With Quote #6

Quote:
Originally Posted by Suicid3
Zenith77 just stop.
You can't compare strings with == you have to use the string functions
equal() equali() contain() and containi()
ooo thank you!
wonsae is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-03-2006 , 18:15  
Reply With Quote #7

new problem

Code:
16:56:28: [FUN] Player out of range (0)
L 05/03/2006 - 16:56:28: [AMXX] Displaying debug trace (plugin "realmod.amxx")
L 05/03/2006 - 16:56:28: [AMXX] Run time error 10: native error (native "set_user_rendering")
L 05/03/2006 - 16:56:28: [AMXX]    [0] realmod.sma::sick (line 96)
L 05/03/2006 - 16:56:29: [FUN] Player out of range (0)
L 05/03/2006 - 16:56:29: [AMXX] Displaying debug trace (plugin "realmod.amxx")
L 05/03/2006 - 16:56:29: [AMXX] Run time error 10: native error (native "set_user_rendering")
L 05/03/2006 - 16:56:29: [AMXX]    [0] realmod.sma::sick (line 96)
L 05/03/2006 - 16:56:30: [FUN] Player out of range (0)
L 05/03/2006 - 16:56:30: [AMXX] Displaying debug trace (plugin "realmod.amxx")
L 05/03/2006 - 16:56:30: [AMXX] Run time error 10: native error (native "set_user_rendering")
L 05/03/2006 - 16:56:30: [AMXX]    [0] realmod.sma::sick (line 96)
I seem to get this when I use the amx_sick command

this is the sick function

Code:
public adminsick(id){     new arg[33], sickness[33], name     read_argv(1,arg,32)     read_argv(2,sickness,32)     name = str_to_num(arg)     get_user_name(id,arg,32)     if(!is_user_alive(name)) return PLUGIN_HANDLED     if(is_user_connected(name)) return PLUGIN_HANDLED     if(equal(arg, "") || equal(sickness, "")) {         client_print(id,print_console,"Usage: amx_sick <name> <flu,cold,headache>")         return PLUGIN_HANDLED     }     if(equal(sickness,"cold")){         has_cold[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(equal(sickness,"flu")){         has_flu[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     if(equal(sickness,"headache")){         has_headache[name] = true         client_print(id,print_chat,"[RealMod] You gave %s a %s",name,sickness)     }     return PLUGIN_HANDLED }
wonsae is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-03-2006 , 19:15  
Reply With Quote #8

Code:
public adminsick(id, level, cid) {     if (cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new szArg1[32], szArg2[32]     read_argv(1, szArg1, 31)     read_argv(2, szArg2,31)         new Target = cmd_target(id, szArg1, 14)         if (!Target)         return PLUGIN_HANDLED             if(equali(szArg2, "cold"))         has_cold[Target] = true     else if(equali(szArg2, "flu"))         has_flu[Target] = true     else if(equali(szArg2, "headache"))         has_headache[Target] = true         new szName[32]     get_user_name(Target, szName, 31)         client_print(id, print_chat, "[RealMod] You gave %s a %s", szName, szArg2)         return PLUGIN_HANDLED }
__________________
FatalisDK is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-03-2006 , 20:17  
Reply With Quote #9

The reason that you're getting run time errors is because FUN is trying to set rendering on a player that isn't connected. After you create 'id', add this:
Code:
if(!is_user_connected(id))     return PLUGIN_HANDLED;
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 05:06.


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