Raised This Month: $12 Target: $400
 3% 

[HELP] cs_set_user_model [o.O]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-21-2009 , 08:37   [HELP] cs_set_user_model [o.O]
Reply With Quote #1

why this doesn't works? o.O
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(PLUGINVERSIONAUTHOR)
    
    
// 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(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
       return 
PLUGIN_HANDLED
       
    
new Argument[32], status[4]
    
    
read_argv(1Argument31)
    
    if (
equal(status"1"))
    {
        new 
CstTeams:userTeam cs_get_user_team(id)
        if (
userTeam == CS_TEAM_T)
        {
            
cs_set_user_model(id"sas")
        }
        else if(
userTeam == CS_TEAM_CT)
        {
            
cs_set_user_model(id"guerilla")
        }
        else
        {
            
cs_reset_user_model(id)
        }
    }
    if (
equal(status"0"))
    {
        
cs_reset_user_model(id)
    }
    return 
PLUGIN_HANDLED

Emilioneri is offline
Send a message via Skype™ to Emilioneri
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-21-2009 , 08:39   Re: [HELP] cs_set_user_model [o.O]
Reply With Quote #2

seems like you don't know how to script.

you haven't assigned anything to 'status'.
you never used 'Argument'.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 05-21-2009 at 08:41.
Dores is offline
Zombie Lurker
Senior Member
Join Date: Mar 2009
Old 05-21-2009 , 08:46   Re: [HELP] cs_set_user_model [o.O]
Reply With Quote #3

Try this code. I havent tested it ingame but it sure compiles properly.

Quote:
/* Plugin generated by Emilioneri */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Spy"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"

new bool:amx_spy[33]

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))
amx_spy[id] = true

}

public resetModel(id, level, cid) {
if (amx_spy[id]) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, "sas")
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, "guerilla")
}
else {
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
__________________

Last edited by Zombie Lurker; 05-21-2009 at 08:49.
Zombie Lurker is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-21-2009 , 09:25   Re: [HELP] cs_set_user_model [o.O]
Reply With Quote #4

Quote:
Originally Posted by Dores View Post
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(PLUGINVERSIONAUTHOR
    
    
// 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(idlevelcid

    if (!
cmd_access(idlevelcid3)) 
        return 
PLUGIN_HANDLED 
    
    
new Argument[32], status[4
    
    
read_argv(1Argument31)
    
read_argv(2status3)
    
    new 
Target cmd_target(idArgumentCMDTARGET_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.
Emilioneri is offline
Send a message via Skype™ to Emilioneri
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 05-21-2009 , 09:38   Re: [HELP] cs_set_user_model [o.O]
Reply With Quote #5

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(PLUGINVERSIONAUTHOR
    
    
// 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(idlevelcid

    if (!
cmd_access(idlevelcid3)) 
        return 
PLUGIN_HANDLED 
    
    
new Argument[32], status[4
    
    
read_argv(1Argument31)
    
read_argv(2status3)
    
    new 
Target cmd_target(idArgumentCMDTARGET_ALLOW_SELF)
    
    if (
Target)
    {
        if (
equal(status"1")) 
        { 
            if (
cs_get_user_team(id) == CS_TEAM_T)  // line 42
            

                
cs_set_user_model(Target"sas"
            } 
            else if(
cs_get_user_team(id) == 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

__________________
alan_el_more is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-21-2009 , 13:36   Re: [HELP] cs_set_user_model [o.O]
Reply With Quote #6

PHP Code:
CstTeams:userTeam

--->

CsTeams:userTeam 
also, you don't need to use equal to compare 1 character, you can just do:
PHP Code:
if (status[0] == '1')
{
      
// first char is '1'.

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
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:09.


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