AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Compile Errors [FAST HELP] (https://forums.alliedmods.net/showthread.php?t=60894)

X-Script 09-15-2007 19:50

Compile Errors [FAST HELP]
 
I'm trying to remake this sloppy, unsupported plugin that was left behind and i'm going to submit it. It doesn't compile and i've tried everything to get rid of these errors but nothing works, can someone clean up the code so it will compile correctly please?

Code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Last Level Boss"
#define VERSION "1.0"
#define AUTHOR "X-Script"

new player 
new bossPower
new old_mp_autoteambalance 
new old_mp_roundtime
new old_mp_buytime
new old_mp_freezetime
new old_mp_startmoney

Float
:old_mp_roundtime
Float
:old_mp_buytime 
Float
:old_mp_freezetime 
Float
:old_mp_startmoney

public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_menucmd(register_menuid("Team_Select"),(1<<0)|(1<<1)|(1<<4)|(1<<5),"hook_team_select")
    
register_menucmd(-2,(1<<0)|(1<<1)|(1<<4)|(1<<5),"hook_team_select")
    
    
register_concmd("amx_setboss""CreateBoss"ADMIN_KICK"- Makes a player the big boss")
    
register_concmd("amx_unsetboss""DestroyBoss"ADMIN_KICK"- Ends the big boss event")
    
register_concmd("say /bossinfo""BossInfo", -1"- Displays information on the boss")
    
register_event("TeamScore""hook_teamscore""a")
    
player=0
}

public 
hook_team_select(idkey)
{
    if (( 
key==0) && ( player!=))
    {
        
engclient_cmd(id,"chooseteam")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
CreateBoss(idlevelcid)
{
    if (
cmd_access(id,level,cid,1))
    
set_task(5.0,"UnmakeBoss")
    return 
PLUGIN_HANDLED
}

public 
hook_teamscore()
{
    new 
score=read_data(2)
    
    if ((
score >0) && (player !=0))
    
UnmakeBoss()
    return 
PLUGIN_HANDLED
}

public 
UnmakeBoss()
{
    if (
player == 0)
    return 
PLUGIN_CONTINUE
    
    
if (is_user_connected(player))
    
    
set_user_rendering(player,kRenderFxGlowShell,0,0,0,kRenderNormal,99)
    
player 0
    
    set_cvar_float
("mp_roundtime",old_mp_roundtime)
    
set_cvar_float("mp_buytime",old_mp_buytime)
    
set_cvar_num("mp_autoteambalance",old_mp_autoteambalance)
    
set_cvar_num("mp_freezetime",old_mp_freezetime)
    
set_cvar_num("mp_startmoney",old_mp_startmoney)
    
set_cvar_num("sv_restart",1)
    return 
PLUGIN_HANDLED
}

public 
cmdMakeBoss(idlevelcid)
{
    if (!
cmd_access (idlevelcid3) )
    return 
PLUGIN_HANDLED
    
    
if(player!=0)
    {
        
client_print(id,print_console,"[AMXX] There is already a boss in the game")
        return 
PLUGIN_HANDLED
    
}
    
    new 
arg[32]
    
read_argv(1arg31)
    
    
player cmd_target(idarg6)
    if(!
player)
    return 
PLUGIN_HANDLED
    
    read_argv
(2,arg,31)
    
bossPower=max(201,min(999,str_to_num(arg)))
    
    new 
players[32]
    new 
[32]
    
get_players(playersnum)
    for(
i=0;i<num;i++)
        if (
players[i]!=player)
        {
            
get_user_team(players[i] ,arg31)
            if (
arg[0]!='S'cs_set_user_team (players[i], CS_TEAM_CT)
        }else{
            
cs_set_user_team(player,CS_TEAM_T,CS_T_GUERILLA)
            
old_mp_autoteambalance =get_cvar_num("mp_autoteambalance")
            
old_mp_roundtime =get_cvar_float("mp_roundtime")
            
old_mp_buytime =get_cvar_float("mp_buytime")
            
old_mp_startmoney =get_cvar_num("mp_startmoney")
            
old_mp_freezetime =get_cvar_num("mp_freezetime")
            
set_cvar_num("mp_autoteambalance",0)
            
set_cvar_num("mp_roundtime",9)
            
set_cvar_num("mp_startmoney",16000)
            
set_cvar_num("sv_restart",1)
            
set_cvar_float("mp_buytime",0.2)
            
set_cvar_num("mp_freezetime",12)
            
set_task(13.0,"MakeBoss2")
        }
    }
    return 
PLUGIN_HANDLED
}

public 
MakeBoss2()
{
    if (
is_user_connected(player))
    {
        
set_user_health(playerbossPower)
        
set_user_armor(player100)
        
set_user_rendering(player,kRenderFxGlowShell,255,67,12,kRenderNormal,99)
        
strip_user_weapons(player)
        
give_item(player,"weapon_knife")
        
give_item(player,"weapon_hegrenade")
        
give_item(player,"weapon_m249")
        
        new 
i
        
for(i=0;i<7;i++)give_item(player,"ammo_556natobox")
    }else{
        
Unmakeboss()
        
        
set_hudmessage(241100871.00.351)
        
show_hudmessage(0"*DEFEAT THE BOSS*")
    }
    return 
PLUGIN_HANDLED


Error Message:
Code:

Your plugin failed to compile! Read the errors below:
 Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/textNilJr0.sma(19) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/textNilJr0.sma(71) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/textNilJr0.sma(72) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/textNilJr0.sma(103) : error 017: undefined symbol "num"
/home/groups/amxmodx/tmp3/textNilJr0.sma(103 -- 104) : error 088: number of arguments does not match definition
/home/groups/amxmodx/tmp3/textNilJr0.sma(104) : error 033: array must be indexed (variable "i")
/home/groups/amxmodx/tmp3/textNilJr0.sma(104) : fatal error 107: too many error messages on one line

Compilation aborted.


5 Errors.

ConnorMcLeod 09-15-2007 20:11

Re: Compile Errors [FAST HELP]
 
Fixed your errors but code won't work if you let it like that.

That is silly :
new old_mp_roundtime
new old_mp_buytime
new old_mp_freezetime
new old_mp_startmoney

Float
:old_mp_roundtime
Float
:old_mp_buytime
Float
:old_mp_freezetime
Float
:old_mp_startmoney


Either you have to declare only one time each variable.
Either you want to make an integer a float, then you have to use Code:
float(int)

but then you have to do it in a function.



Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN "Last Level Boss" #define VERSION "1.0" #define AUTHOR "X-Script" new player new bossPower new old_mp_autoteambalance /*new old_mp_roundtime new old_mp_buytime*/ new old_mp_freezetime new old_mp_startmoney new Float:old_mp_roundtime new Float:old_mp_buytime /*Float:old_mp_freezetime Float:old_mp_startmoney*/ public plugin_init(){     register_plugin(PLUGIN, VERSION, AUTHOR)     register_menucmd(register_menuid("Team_Select"),(1<<0)|(1<<1)|(1<<4)|(1<<5),"hook_team_select")     register_menucmd(-2,(1<<0)|(1<<1)|(1<<4)|(1<<5),"hook_team_select")         register_concmd("amx_setboss", "CreateBoss", ADMIN_KICK, "- Makes a player the big boss")     register_concmd("amx_unsetboss", "DestroyBoss", ADMIN_KICK, "- Ends the big boss event")     register_concmd("say /bossinfo", "BossInfo", -1, "- Displays information on the boss")     register_event("TeamScore", "hook_teamscore", "a")     player=0 } public hook_team_select(id, key) {     if (( key==0) && ( player!=0 ))     {         engclient_cmd(id,"chooseteam")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public CreateBoss(id, level, cid) {     if (cmd_access(id,level,cid,1))     set_task(5.0,"UnmakeBoss")     return PLUGIN_HANDLED } public hook_teamscore() {     new score=read_data(2)         if ((score >0) && (player !=0))     UnmakeBoss()     return PLUGIN_HANDLED } public UnmakeBoss() {     if (player == 0)     return PLUGIN_CONTINUE         if (is_user_connected(player))         set_user_rendering(player,kRenderFxGlowShell,0,0,0,kRenderNormal,99)     player = 0         set_cvar_float("mp_roundtime",old_mp_roundtime)     set_cvar_float("mp_buytime",old_mp_buytime)     set_cvar_num("mp_autoteambalance",old_mp_autoteambalance)     set_cvar_num("mp_freezetime",old_mp_freezetime)     set_cvar_num("mp_startmoney",old_mp_startmoney)     set_cvar_num("sv_restart",1)     return PLUGIN_HANDLED } public cmdMakeBoss(id, level, cid) {     if (!cmd_access (id, level, cid, 3) )     return PLUGIN_HANDLED         if(player!=0)     {         client_print(id,print_console,"[AMXX] There is already a boss in the game")         return PLUGIN_HANDLED     }         new arg[32]     read_argv(1, arg, 31)         player = cmd_target(id, arg, 6)     if(!player)     return PLUGIN_HANDLED         read_argv(2,arg,31)     bossPower=max(201,min(999,str_to_num(arg)))         new players[32], num     new i //[32]     get_players(players, num)     for(i=0;i<num;i++) {         if (players[i]!=player)         {             get_user_team(players[i] ,arg, 31)             if (arg[0]!='S') cs_set_user_team (players[i], CS_TEAM_CT)         }else{             cs_set_user_team(player,CS_TEAM_T,CS_T_GUERILLA)             old_mp_autoteambalance =get_cvar_num("mp_autoteambalance")             old_mp_roundtime =get_cvar_float("mp_roundtime")             old_mp_buytime =get_cvar_float("mp_buytime")             old_mp_startmoney =get_cvar_num("mp_startmoney")             old_mp_freezetime =get_cvar_num("mp_freezetime")             set_cvar_num("mp_autoteambalance",0)             set_cvar_num("mp_roundtime",9)             set_cvar_num("mp_startmoney",16000)             set_cvar_num("sv_restart",1)             set_cvar_float("mp_buytime",0.2)             set_cvar_num("mp_freezetime",12)             set_task(13.0,"MakeBoss2")         }     }     return PLUGIN_HANDLED } public MakeBoss2() {     if (is_user_connected(player))     {         set_user_health(player, bossPower)         set_user_armor(player, 100)         set_user_rendering(player,kRenderFxGlowShell,255,67,12,kRenderNormal,99)         strip_user_weapons(player)         give_item(player,"weapon_knife")         give_item(player,"weapon_hegrenade")         give_item(player,"weapon_m249")                 new i         for(i=0;i<7;i++)give_item(player,"ammo_556natobox")     }else{ //        Unmakeboss()                 set_hudmessage(241, 100, 87, 1.0, 0.35, 1)         show_hudmessage(0, "*DEFEAT THE BOSS*")     }     return PLUGIN_HANDLED }

X-Script 09-15-2007 20:33

Re: Compile Errors [FAST HELP]
 
It gives me more errors now.

ConnorMcLeod 09-15-2007 20:56

Re: Compile Errors [FAST HELP]
 
I have no errors, but i don't want to check the code.

I had to :

declare num (for get_players)
comment [32] (you declares i[32])
I had to comment Unmakeboss in the last function, don't know why.

Also please make identations to make your code more readable

If you want better help (no fast one...), ou'll have to wait better coders to have a look.

X-Script 09-15-2007 21:08

Re: Compile Errors [FAST HELP]
 
Okay I see what I did wrong, thanks connorr can you test this for me on Counter-Strike? On condition-zero it's not working and my counter-strike doesn't run properly.


All times are GMT -4. The time now is 16:08.

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