AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   i get this error (https://forums.alliedmods.net/showthread.php?t=17008)

Diablo-89 08-24-2005 09:47

i get this error
 
im making a plugin for cstrike
i get this error when i compile:


//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// hostageprotect.sma
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(1 9) : error 010: invalid function or
declaration
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(2 0) : error 010: invalid function or
declaration
//
// 2 Errors.
// Could not locate output file C:\Program Files\Valve\Steam\SteamApps\miss_moll
iej\dedicated server\cstrike\addons\amxmodx\scripting\compi led\hostageprotect.am
x (compile failed).
//
// Compilation Time: 1.72 sec
// ----------------------------------------

Press enter to exit ...





when i look at those lines (19 and 21)

there is this... and i dont see the reason for the error???



#include <amxmodx>
#include <engine>
#include <amxmisc>

#define TEAM_T 1
#define TEAM_CT 2
#define MAXSPAWNPOINTS 64 // the max number of spawnpoints the plugin supports

public plugin_init() {
register_plugin("hostage protect","1.3","Diablo");
register_cvar("amx_hostageprotect","0");
register_cvar("amx_slaytime","4.9")
register_logevent("Event_NewRound",2,"0=World triggered","1=Round_Start")
register_event("TextMsg","HostageKilled","b", "2&#Killed_Hostage")
}


// if cvar is 0 plugin is off
if (get_cvar_num("amx_hostageprotect") == 0 )
{ return PLUGIN_HANDLED;
}

public function() {
new rescuezone
find_ent_by_class(-1, "func_hostage_rescue")
remove_entity(rescuezone)
}

stock SwitchTeams() // This function turns the team spawn points around, and switches the owner of the buyzone
{
new EntNums[MAXSPAWNPOINTS+1]
new EntCount = 0
new Float:TSpawnsO[MAXSPAWNPOINTS/2][3]
new Float:CTSpawnsO[MAXSPAWNPOINTS/2][3]
new Float:TSpawnsA[MAXSPAWNPOINTS/2][3]
new Float:CTSpawnsA[MAXSPAWNPOINTS/2][3]
new TSpawnCount = 0
new CTSpawnCount = 0

new ClassName[32]
for(new i=g_MaxPlayers+1;i<g_MaxEnts;i++) if(is_valid_ent(i) && entity_get_edict(i, EV_ENT_owner) == 0)
{
new bool:HasChanged = false
entity_get_string(i,EV_SZ_classname,ClassName ,31)

if(equal(ClassName,"func_buyzone"))
{
new Team = entity_get_int(i,EV_INT_team)
if(Team == TEAM_CT)
entity_set_int(i,EV_INT_team,TEAM_T)
else if(Team == TEAM_T)
entity_set_int(i,EV_INT_team,TEAM_CT)
}
else if(equal(ClassName,"info_player_deathmatch")) // Means the team is Terror
{
EntNums[EntCount] = i
EntCount++

entity_get_vector(i,EV_VEC_origin,TSpawnsO[TSpawnCount])
entity_get_vector(i,EV_VEC_angles,TSpawnsA[TSpawnCount])
TSpawnCount++
HasChanged = true
}
else if(equal(ClassName,"info_player_start")) // Means we are talking Counter strike
{
EntNums[EntCount] = i
EntCount++

entity_get_vector(i,EV_VEC_origin,CTSpawnsO[CTSpawnCount])
entity_get_vector(i,EV_VEC_angles,CTSpawnsA[CTSpawnCount])
CTSpawnCount++
HasChanged = true
}
if(HasChanged == true && ( EntCount == MAXSPAWNPOINTS || TSpawnCount == MAXSPAWNPOINTS / 2 || CTSpawnCount == MAXSPAWNPOINTS / 2) )
{
log_amx("This map has to many spawnpoints, Try increasing the value of: #define MAXSPAWNPOINTS in the .sma file, and recompile the plugin.")
return 0
}
}
new CTSpawnsUsed = 0
new TSpawnsUsed = 0

for(new i=0;i<=EntCount;i++) if(EntNums[i] != 0)
{
entity_get_string(EntNums[i],EV_SZ_classname,ClassName,31)

if(equal(ClassName,"info_player_deathmatch") && CTSpawnsUsed <= TSpawnCount ) // Means the team is Terror
{
entity_set_vector(EntNums[i],EV_VEC_origin,CTSpawnsO[CTSpawnsUsed])
entity_set_vector(EntNums[i],EV_VEC_angles,CTSpawnsA[CTSpawnsUsed])
CTSpawnsUsed++
}
else if(equal(ClassName,"info_player_start") && TSpawnsUsed <= CTSpawnCount) // Means we are talking Counter strike
{
entity_set_vector(EntNums[i],EV_VEC_origin,TSpawnsO[TSpawnsUsed])
entity_set_vector(EntNums[i],EV_VEC_angles,TSpawnsA[TSpawnsUsed])
TSpawnsUsed++
}
}
return 1
}

public Event_NewRound()
{
set_task(get_cvar_float("amx_slaytime"),"Slay Terrors",2932)
}

public SlayTerrors()
{
new aPlayers[32],iNum,i
get_players(aPlayers,iNum,"ae","TERRORIST")

for(i = 0; i <= iNum; i++)
{
new id = aPlayers[i]
if(!is_user_connected(id)) continue
user_kill(id)
}
}

new g_iHostages

public HostageKilled()
{
new iEnts = get_global_int(GL_maxEntities)

g_iHostages = 0

for(new i = -1; i <= iEnts; i++)
{
if(!is_valid_ent(i)) continue

new szClassName[32]
entity_get_string(i,EV_SZ_classname,szClassNa me,31)
if(equali(szClassName,"hostage_entity"))
g_iHostages++
}

if(g_iHostages <= 0)
{
new aPlayers[32],iNum,i
get_players(aPlayers,iNum,"ae","CT")

for(i = 0; i <= iNum; i++)
{
new id = aPlayers[i]
if(!is_user_connected(id)) continue
user_kill(id)
}
}
}



plz help me out here :D



thanx greetz Diablo :twisted:






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

v3x 08-24-2005 09:52

Show me the whole function.

Diablo-89 08-24-2005 10:06

there you go... i updated my last post now its the entire plugin

thanx allot in advance




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

DataMatrix 08-24-2005 10:12

Try this:
Code:
new hostageprotect[32] get_cvar_num("amx_hostageprotect",hostageprotect,31) if (equal(hostageprotect,"0")) {     return PLUGIN_HANDLED; }

Instead of this:
Code:
if (get_cvar_num("amx_hostageprotect") == 0 ) { return PLUGIN_HANDLED; }

v3x 08-24-2005 10:15

You cannot have any AMXX native outside of any function/forward. You must put it inside. I thought that's what you did wrong. :P

Diablo-89 08-24-2005 10:16

nope :cry:


//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// hostageprotect.sma
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(2 0) : error 021: symbol already defi
ned: "get_cvar_num"
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(2 1) : error 010: invalid function or
declaration
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(2 2) : error 010: invalid function or
declaration
// C:\Program Files\Valve\Steam\SteamApps\miss_molliej\dedi cated server\cstrike\
addons\amxmodx\scripting\hostageprotect.sma(1 55) : warning 203: symbol is never
used: "hostageprotect"
//
// 3 Errors.
// Could not locate output file C:\Program Files\Valve\Steam\SteamApps\miss_moll
iej\dedicated server\cstrike\addons\amxmodx\scripting\compi led\hostageprotect.am
x (compile failed).
//
// Compilation Time: 1.67 sec
// ----------------------------------------

Press enter to exit ...

v3x 08-24-2005 10:19

Code:
// if cvar is 0 plugin is off if (get_cvar_num("amx_hostageprotect") == 0 )     { return PLUGIN_HANDLED; }
That MUST be inside of a function/forward.

DataMatrix 08-24-2005 10:21

Hmm, remove the code where its reporting the error and add this instead:
Code:
public test123() {     new hostageprotect[32]     get_cvar_num("amx_hostageprotect",hostageprotect,31)     if (equal(hostageprotect,"0")) {         return PLUGIN_HANDLED;     } }

Then add test123 to plugin_init, e.g:

Code:
public plugin_init() {     test123 }

Diablo-89 08-24-2005 10:22

so where do i place that then?? :oops:

v3x 08-24-2005 10:22

Inside one of your functions ( at the top ).

Code:
if(get_cvar_num("blah_blah")) {     return PLUGIN_HANDLED }


All times are GMT -4. The time now is 14:24.

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