Raised This Month: $ Target: $400
 0% 

need help with 2 plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-01-2005 , 15:18   need help with 2 plugins
Reply With Quote #1

im working on 2 plugins now and i got some problems, on the classes plugin the resethud thing dont seem work and on the stats plugin i get theese errors when i compile:

Code:
(9) : error 017: undefined symbol "id" 
(9 -- 10) : error 008: must be a constant expression; assumed zero
the stats plugin:

Code:
 //----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <engine>  #include <fun>  //----------------------------------------------------------------------------------------------  // VARIABLES  new constitution[33] = 1  new hp[33] = 10 * (constitution[id])  new pointsleft[33] = 5  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Stats", "1.0", "Belsebub")     register_menucmd(register_menuid("Stats Menu"), 1023, "ActionMenu")     register_clcmd("say /statsmenu", "ShowMenu", -1, "Shows The stats menu")     register_event("ResetHUD", "Event_Resethud", "a")  }  //----------------------------------------------------------------------------------------------  public ShowMenu(id)  {     new szMenuBody[256]     new keys     new len = format( szMenuBody, 255, "Stats Menu:^nPoints Left:%d^n",pointsleft )     len += format( szMenuBody[len], 255-len, "^n\w1. Constitution (%d)",constitution )     len += format( szMenuBody[len], 255-len, "^n\w2. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w3. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w4. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w5. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ActionMenu(id, key)  {     switch(key)     {         case 0:         {             constitution[id] += 1             pointsleft[id] -= 1         }         case 1:         {             return PLUGIN_CONTINUE         }         case 2:         {             return PLUGIN_CONTINUE         }         case 3:         {             return PLUGIN_CONTINUE         }         case 4:         {             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id)  {     if (constitution[id] == 1) {         return PLUGIN_CONTINUE     }     new health = get_user_health ( id )     set_user_health(id, health + hp[id])     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------

the classes plugin:

Code:
 //----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <fun>  #include <cstrike>  //----------------------------------------------------------------------------------------------  // VARIABLES  new bool:Sniper[33] = false  new bool:Engineer[33] = false  new bool:Medic[33] = false  new bool:NoClass[33] = true  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Classes","0.1","Belsebub")     register_event("ResetHUD", "Event_Resethud", "a")     register_menucmd(register_menuid("Class Menu:"),1023,"ActionMenu")     register_clcmd("say /changeclass","ShowMenu")  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id)  {     if (NoClass[id] == true)  {         ShowMenu(id)         return PLUGIN_CONTINUE         } else if (Sniper[id] == true) {         set_user_maxspeed(id, 320.0)         give_item(id, "weapon_scout")         set_user_footsteps(id,1)         } else if (Engineer[id] == true) {         set_user_health(id,150)         } else if (Medic[id] == true) {         set_user_health(id,200)     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ShowMenu(id)  {     new szMenuBody[512]     new keys     new len = format(szMenuBody, 511, "\yClass Menu:^n" )     len += format( szMenuBody[len], 511-len, "^n\w1. Sniper" )     len += format( szMenuBody[len], 511-len, "^n\w2. Engineer" )     len += format( szMenuBody[len], 511-len, "^n\w3. Medic" )     len += format( szMenuBody[len], 511-len, "^n\w4. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //--------------------------------------------------------------------------------------------  public ActionMenu(id,key)  {     switch(key)     {         case 0:         {             Sniper[id] = true             Engineer[id] = false             Medic[id] = false             NoClass[id] = false         }         case 1:         {             Sniper[id] = false             Engineer[id] = true             Medic[id] = false             NoClass[id] = false         }         case 2:         {             Sniper[id] = false             Engineer[id] = false             Medic[id] = true             NoClass[id] = false         }         case 3:         {             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------
Belsebub is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-06-2005 , 08:44  
Reply With Quote #2

cant anyone help me?
Belsebub is offline
Ced
Member
Join Date: Oct 2004
Old 04-06-2005 , 09:35  
Reply With Quote #3

Code:
new hp[33] = 10 * (constitution[id])
This cannot be done since id is not known at the time u declare this variable.

And try changing the flag to "b" on the resethud
Ced is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-06-2005 , 09:39  
Reply With Quote #4

ty, and then what to change the [id] to?
Belsebub is offline
Ced
Member
Join Date: Oct 2004
Old 04-06-2005 , 09:54  
Reply With Quote #5

just declare
Code:
new hp[33]
and then put
Code:
hp[id] = 10 * constitution[id]
before u set the hp
Ced is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-06-2005 , 14:25  
Reply With Quote #6

Quote:
Code:
hp[id] = 10 * constitution[id]
Why do you want players to gain advantages by joining the game at different times? This is a really odd and stupid equation.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-06-2005 , 14:29  
Reply With Quote #7

what?
Belsebub is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-07-2005 , 10:17  
Reply With Quote #8

still have problems with the resethud event and in the stats plugin it doesn't add 1 to constitution if i choose that in the menu and doesn't remove 1 pointsleft, and i replaced the hp[id] = 10 * constitution[id] thing with a switch

new stats plugin:
Code:
 //----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <engine>  #include <fun>  //----------------------------------------------------------------------------------------------  // VARIABLES  new constitution[33] = 0  new pointsleft[33] = 5  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Stats", "1.0", "Belsebub")     register_menucmd(register_menuid("Stats Menu"), 1023, "ActionMenu")     register_clcmd("say /statsmenu", "ShowMenu", -1, "Shows The stats menu")     register_event("ResetHUD", "Event_Resethud", "b")  }  //----------------------------------------------------------------------------------------------  public ShowMenu(id)  {     if (pointsleft[id] == 0) {         client_print(id, print_center, "[AMXX] You Have 0 Stat Points Left.")         return PLUGIN_CONTINUE     }     new szMenuBody[256]     new keys     new len = format( szMenuBody, 255, "Stats Menu:^nPoints Left:%d^n",pointsleft )     len += format( szMenuBody[len], 255-len, "^n\w1. Constitution (%d)",constitution )     len += format( szMenuBody[len], 255-len, "^n\w2. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w3. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w4. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w5. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ActionMenu(id, key)  {     switch(key)     {         case 0:         {             constitution[id] += 1             pointsleft[id] -= 1             set_task ( 0.2, "ShowMenu", id )         }         case 1:         {             set_task ( 0.2, "ShowMenu", id )         }         case 2:         {             set_task ( 0.2, "ShowMenu", id )         }         case 3:         {             set_task ( 0.2, "ShowMenu", id )         }         case 4:         {             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id, constitution)  {     new health = get_user_health ( id )     switch(constitution)     {         case 1:         {             set_user_health(id, health + 10)         }         case 2:         {             set_user_health(id, health + 20)         }         case 3:         {             set_user_health(id, health + 30)         }         case 4:         {             set_user_health(id, health + 40)         }         case 5:         {             set_user_health(id, health + 50)         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------
Belsebub is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-07-2005 , 14:46  
Reply With Quote #9

Code:
constitution[id]++ pointsleft[id]--
Shouldn't that do the same thing?
__________________
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 09:49.


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