Quote:
Originally Posted by Dores
seems like you don't know how to script.
you haven't assigned anything to 'status'.
you never used 'Argument'.
|
OMG! I forgot about that!
now it works, but code compiles with 3 warnings:
PHP Code:
/* Plugin generated by Emilioneri */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Spy"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
// Add your code here...
register_concmd("amx_spy", "cmd_spy", ADMIN_SLAY, "< saxeli | #userid > 1/0")
}
public plugin_precache()
{
precache_model("models/player/sas/sas.mdl")
precache_model("models/player/guerilla/guerilla.mdl")
}
public cmd_spy(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new Argument[32], status[4]
read_argv(1, Argument, 31)
read_argv(2, status, 3)
new Target = cmd_target(id, Argument, CMDTARGET_ALLOW_SELF)
if (Target)
{
if (equal(status, "1"))
{
new CstTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) // line 42
{
cs_set_user_model(Target, "sas")
}
else if(userTeam == CS_TEAM_CT) // line 46
{
cs_set_user_model(Target, "guerilla")
}
else
{
cs_reset_user_model(Target)
}
}
if (equal(status, "0"))
{
cs_reset_user_model(id)
}
}
return PLUGIN_HANDLED
}
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Warning: Tag mismatch on line 42
Warning: Tag mismatch on line 42
Warning: Tag mismatch on line 46
Header size: 568 bytes
Code size: 3504 bytes
Data size: 1056 bytes
Stack/heap size: 16384 bytes; estimated max. usage=781 cells (3124 bytes)
Total requirements: 21512 bytes
3 Warnings.
Done.