Raised This Month: $ Target: $400
 0% 

more code not compiling...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-21-2006 , 07:59   more code not compiling...
Reply With Quote #1

Check this out...

invalid experession assumed 0 on line 11

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN = "TeamSwitch" #define VERSION = "1.0" #define AUTHOR = "SweatyBanana" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /ct", "TEAMCT")     register_clcmd("say_team /ct", "TEAMCT")     register_clcmd("say /t", "TEAMT")     register_clcmd("say_team /t", "TEAMT")     register_clcmd("say /spec", "SPEC")     register_clcmd("say_team /spec", "SPEC") } public TEAMCT() {     if(cs_get_user_team(id) == CS_TEAM_CT)     {         client_print(1, print_chat, "[TEAMS] You are already on the CT team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_CT)     {         return PLUGIN_CONTINUE     }         else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_CT, CS_CT_URBAN)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)     } } public TEAMT() {     if(cs_get_user_team(id) == CS_TEAM_T)     {         client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_T)     {         return PLUGIN_CONTINUE     }             else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_T, CS_T_TERROR)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)     } } public SPEC() {     if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)     {         client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)     {         return PLUGIN_CONTINUE     }         else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_SPECTATOR)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the SPECTATORS", name)     } }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-21-2006 , 08:00  
Reply With Quote #2

What did i do wrong here?

Code:
    register_plugin(PLUGIN, VERSION, AUTHOR)
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-21-2006 , 08:03  
Reply With Quote #3

Oh...and this code..


Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN = "round_money" #define VERSION = "1.0" #define AUTHOR = "Me" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("round_money", "16000")     register_event("ResetHUD", "roundMoney", "be") } public roundMoney(id) {     new Players[32]     new playerCount, i, user     get_players(Players, playerCount, "b")     for (i=0; i<playerCount; i++)     new player = Players[i]     new money =  cs_get_user_money (id)         new cVar = get_cvar_num(round_money)         if(money < cVar)     {               cs_set_user_money (id , round_money, 1) // sets users money to round_money and flashes the update     }     return PLUGIN_CONTINUE }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 03-21-2006 , 08:18  
Reply With Quote #4

fixed versions:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "TeamSwitch" #define VERSION "1.0" #define AUTHOR "SweatyBanana" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /ct", "TEAMCT")     register_clcmd("say_team /ct", "TEAMCT")     register_clcmd("say /t", "TEAMT")     register_clcmd("say_team /t", "TEAMT")     register_clcmd("say /spec", "SPEC")     register_clcmd("say_team /spec", "SPEC") } public TEAMCT( id ) {     if(cs_get_user_team(id) == CS_TEAM_CT)     {         client_print(1, print_chat, "[TEAMS] You are already on the CT team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_CT)     {         return PLUGIN_CONTINUE     }         else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_CT, CS_CT_URBAN)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)     }     return PLUGIN_CONTINUE } public TEAMT( id ) {     if(cs_get_user_team(id) == CS_TEAM_T)     {         client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_T)     {         return PLUGIN_CONTINUE     }             else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_T, CS_T_TERROR)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)     }     return PLUGIN_CONTINUE } public SPEC( id ) {     if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)     {         client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")         return PLUGIN_HANDLED     }         if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)     {         return PLUGIN_CONTINUE     }         else     {         new name[32]         get_user_name(id,name,31)         if(is_user_alive(id)) user_kill(id)         cs_set_user_team ( id, CS_TEAM_SPECTATOR)         client_print(0, print_chat, "[TEAMS] %s has switched himself to the SPECTATORS", name)     }     return PLUGIN_CONTINUE }
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "round_money" #define VERSION "1.0" #define AUTHOR "Me" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("round_money", "16000")     register_event("ResetHUD", "roundMoney", "be") } public roundMoney(id) {     new Players[32]     new playerCount, i     get_players(Players, playerCount, "b")     for (i=0; i<playerCount; i++)     {         new player = Players[i]         new money =  cs_get_user_money (player)             new cVar = get_cvar_num("round_money")             if(money < cVar)         {                     cs_set_user_money (player, cVar, 1) // sets users money to round_money and flashes the update         }     }     return PLUGIN_CONTINUE }

your error where in the makros
eg.
Code:
#define PLUGIN = "round_money"
should be
Code:
#define PLUGIN "round_money"

ALL COMPILER ERRORS FIXED
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-21-2006 , 10:18  
Reply With Quote #5

ty much...

+karma
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-21-2006 , 10:40  
Reply With Quote #6

Code:
new CsTeams:team = cs_get_user_team(id); if(team == CS_TEAM_CT /* or whatever */) {   // }
__________________
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
VEN
Veteran Member
Join Date: Jan 2005
Old 03-22-2006 , 07:40  
Reply With Quote #7

Do you aware that your "else" statements contain unreachable code?

Also conditions builded weird enough. You could just do
Code:
if(cs_get_user_team(id) != CS_TEAM_CT)     return PLUGIN_CONTINUE // code here
VEN is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 03-22-2006 , 08:04  
Reply With Quote #8

Couldn't you also do:

Code:
    if(cs_get_user_team(id) == CS_TEAM_CT)     {         client_print(1, print_chat, "[TEAMS] You are already on the CT team.")         return PLUGIN_HANDLED     } else { //blah }
?

Oh and there's an error
Code:
    if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)     {         client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.") // o.O spectators.         return PLUGIN_HANDLED     }
Jordan is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-23-2006 , 08:05  
Reply With Quote #9

ty sir...me and my stupid mistakes.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Reply



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 16:44.


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