This help page is directly related to my plugin
[fcos]. If you need to view the full plugin script go there and download the .sma file.
I am trying to shorten the code for my plugin fcos by forwarding parameters to fn_fcosandlogentry and fn_showadmin. When I compile I get this
Code:
Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team
Error: Argument type mismatch (argument 2) on line 873
Error: Argument type mismatch (argument 3) on line 888
2 Errors.
Could not locate output file C:\Documents and Settings\Owner\My Documents\CS\serverfinal1\cstrike\addons\amxmodx\scripting\compiled\fcospassfn.amx (compile failed).
Line 873
Code:
fn_fcosandlogentry ( gi_playerID, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
Line 888
Code:
fn_showadmin ( gi_playerID, gi_playerID2, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
I need the cvar name represented by variable s_cvarname to be a parameter in those two functions ( fn_fcosandlogentry and fn_showadmin ). What do I need to do in order to forward/pass the string s_cvarname[] as a parameter and not get arguement type mismatch when compiling? Here is the function line 873 and 888 are in.
Code:
public fn_cl_weather ( gi_playerID, const s_cvarname[], const value[] )
{
gf_valuefromplayer = floatstr ( value )
gf_calfloatvalue = 1.0
if ( ! ( gf_valuefromplayer == gf_calfloatvalue ) )
{
fn_fcosandlogentry ( gi_playerID, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
get_players ( gi_players2, gi_playercnt2, "ch" )
for ( gi_playernum2 = 0; gi_playernum2 < gi_playercnt2; gi_playernum2++ )
{
gi_playerID2 = gi_players2[gi_playernum2]
if ( ! ( is_user_admin ( gi_playerID2 ) ) )
{
return PLUGIN_HANDLED
}
else
{
fn_showadmin ( gi_playerID, gi_playerID2, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
}
}
}
else
{
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
fn_cl_weather is the result function for
Code:
query_client_cvar ( gi_playerID, "cl_weather", "fn_cl_weather" )
which is inside of fn_query1 function for the fcos plugin. Here are the two functions I want s_cvarname forwarded/passed to
Code:
public fn_fcosandlogentry ( gi_playerID, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
{
client_cmd ( gi_playerID, "%s %f", s_cvarname, gf_calfloatvalue )
get_user_name ( gi_playerID, gs_logname, 31 ) // Outputs the user's name into gs_logname
get_user_authid ( gi_playerID, gs_logauthid, 32 ) // Outputs the user's authid into gs_logauthid
get_user_ip ( gi_playerID, gs_logip, 43 ) // Outputs the user's IP into gs_logip
log_amx ( "%L", LANG_SERVER, "FCOS_LANG_LOG_ENTRY", gs_logname, get_user_userid ( gi_playerID ), gs_logauthid, gs_logip, s_cvarname, gf_valuefromplayer, gf_calfloatvalue ) // Logs FCOS_LANG_LOG_ENTRY
}
public fn_showadmin ( gi_playerID, gi_playerID2, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
{
get_user_name ( gi_playerID, gs_logname, 31 )
client_print ( gi_playerID2, print_console, "%L", LANG_SERVER, "FCOS_LANG_SHOW_ADMIN", gs_logname, s_cvarname, gf_valuefromplayer, gf_calfloatvalue )
}
If you can help me forward the string s_cvarname to these two functions please show me how.
Edit: This problem has been solved. Thank you VEN for the help on this.