Raised This Month: $ Target: $400
 0% 

classes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-20-2005 , 04:04   classes
Reply With Quote #1

im working on a plugin that lets u choose a class, and different classes get different things
btw i took most of the code from http://forums.alliedmods.net/showthread.php?t=539

i have only started to work on the sniper class but i get theese errors when i tried to compile

Code:
classes.sma(22) : error 017: undefined symbol "id"
classes.sma(24) : error 017: undefined symbol "id"
classes.sma(24 -- 25) : warning 202: number of arguments does not match definition
classes.sma(24 -- 25) : error 001: expected token: ",", but found "return"
classes.sma(27) : warning 217: loose indentation
classes.sma(27) : error 017: undefined symbol "cur_id"
classes.sma(29) : error 017: undefined symbol "id"
classes.sma(29) : warning 215: expression has no effect
classes.sma(29) : error 001: expected token: ";", but found ")"
classes.sma(29) : error 029: invalid expression, assumed zero
classes.sma(29) : fatal error 107: too many error messages on one line
The Plugin

Code:
//---------------------------------------------------------------------------------------------- #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> //---------------------------------------------------------------------------------------------- new bool:Sniper[33] = false new bool:Engineer[33] = false new bool:Medic[33] = false //---------------------------------------------------------------------------------------------- public plugin_init() {     register_plugin("Classes","0.1","Belsebub")     register_logevent("StartRound",2,"1=Round_Start")     register_menucmd(register_menuid("Class Menu"),1023,"actionMenu")     register_clcmd("say /changeclass","showMenu",0,": shows class menu") } //---------------------------------------------------------------------------------------------- public StartRound() {             if(Sniper[id] == false || Engineer[id] == false || Medic[id] == false)         {             showMenu(id)             return PLUGIN_CONTINUE         }         if(Sniper[cur_id] == true)         {             set_user_maxspeed(id, 2.0)             give_item(id, "weapon_scout")             return PLUGIN_CONTINUE         }         if(Engineer[cur_id] == true)         {             set_user_health(cur_id,150)             return PLUGIN_CONTINUE         }         if(Medic[cur_id] == true)         {             set_user_health(cur_id,200)             return PLUGIN_CONTINUE         }         return PLUGIN_CONTINUE     }     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public actionMenu(id,key) {     switch(key)     {         case 0:         {             Sniper[id] = true             Medic[id] = false             Engineer[id] = false         }         case 1:         {             Engineer[id] = true             Sniper[id] = false             Medic[id] = false         }         case 2:         {             Medic[id] = true             Engineer[id] = false             Sniper[id] = false         }     }     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- 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^n\w4. Exit Option Name" )     keys = (1<<0|1<<1|1<<2|1<<3)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_HANDLED } //--------------------------------------------------------------------------------------------
Belsebub is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-21-2005 , 12:19  
Reply With Quote #2

can anyone help me?
Belsebub is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-21-2005 , 12:26  
Reply With Quote #3

Code:
public StartRound() {      for(new id = 0; id < get_maxplayers(); id++)      {                     if(Sniper[id] == false || Engineer[id] == false || Medic[id] == false)           {                showMenu(id)                return PLUGIN_CONTINUE           }           if(Sniper[id] == true)           {               set_user_maxspeed(id, 2.0)               give_item(id, "weapon_scout")           }           if(Engineer[id] == true)           {               set_user_health(id,150)           }           if(Medic[id] == true)           {               set_user_health(id,200)           }      }     return PLUGIN_HANDLED }
Freecode is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-21-2005 , 12:30  
Reply With Quote #4

still get theese errors

Code:
classes.sma(30) : warning 217: loose indentation
classes.sma(37) : error 017: undefined symbol "cur_id"
classes.sma(37) : warning 215: expression has no effect
classes.sma(37) : error 001: expected token: ";", but found ")"
classes.sma(37) : error 029: invalid expression, assumed zero
classes.sma(37) : fatal error 107: too many error messages on one line
Belsebub is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-21-2005 , 12:31  
Reply With Quote #5

there try again (updated the top code)
Freecode is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-21-2005 , 12:37  
Reply With Quote #6

ty! it compiles

just gives me a loose indentation warning but u dont need to help me with that
Belsebub is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-21-2005 , 14:37  
Reply With Quote #7

i tested the plugin, when freezetime is over it shows the menu like normal, but it does this every round even if i choosed sniper last round, i tested with all classes

this is what i got now:

Code:
 //----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <fun>  #include <cstrike>  //----------------------------------------------------------------------------------------------  new bool:Sniper[33] = false  new bool:Engineer[33] = false  new bool:Medic[33] = false  new bool:NoClass[33] = false  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Classes","0.1","Belsebub")     register_logevent("StartRound",2,"1=Round_Start")     register_menucmd(register_menuid("Class Menu"),1023,"actionMenu")     register_clcmd("say /changeclass","showMenu",0,": shows class menu")  }  //----------------------------------------------------------------------------------------------  public StartRound()  {     for(new id = 0; id < get_maxplayers(); id++)     {         if(Sniper[id] == false || Engineer[id] == false || Medic[id] == false || NoClass[id] == false)         {             showMenu(id)             return PLUGIN_CONTINUE         }         if(Sniper[id] == true)         {             set_user_maxspeed(id, 2.0)             give_item(id, "weapon_scout")             set_user_footsteps(id,1)         }         if(Engineer[id] == true)         {             set_user_health(id,150)         }         if(Medic[id] == true)         {             set_user_health(id,200)         }     }     return PLUGIN_HANDLED  }  //----------------------------------------------------------------------------------------------  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:         {             Sniper[id] = false             Engineer[id] = false             Medic[id] = false             NoClass[id] = true         }     }     return PLUGIN_HANDLED  }  //----------------------------------------------------------------------------------------------  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. No Class" )     len += format( szMenuBody[len], 511-len, "^n^n\w5. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_HANDLED  }  //--------------------------------------------------------------------------------------------
Belsebub is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-21-2005 , 15:10  
Reply With Quote #8

Try putting if already a class - menu does not show.
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-21-2005 , 16:22  
Reply With Quote #9

im a noob at making plugins so can u write the code to add?
Belsebub is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-21-2005 , 16:35  
Reply With Quote #10

Code:
public showMenu(id) {     if(Sniper[id] != false || Engineer[id] != false || Medic[id] != false || NoClass[id] != false) {         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 13:58.


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