Raised This Month: $ Target: $400
 0% 

Need help with assigning values.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-29-2004 , 15:41   Need help with assigning values.
Reply With Quote #1

I'm trying to write a plugin so you can say /afk and you join spectators but it keeps your team and model so when you type /back you join the team you were on with the same model. Maybe my mistake is obvious but I can't get the plugin to choose the right team. I also need help with the get model and set model commands. This is the code I have so far.
Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike>

public plugin_init()
{ 
   register_plugin("AFK and Back","0.1","twistedeuphoria") 
   register_clcmd("say","say_event") 
   return PLUGIN_CONTINUE 
} 
  

public say_event(id) 
{ 
   
    new sid[2] 
    new team[32]    
    new model[32] 
    sid[0] = id 
    num_to_str(id,sid,2) 
    new said[192] 
    read_args(said,191) 
    new name[32] 
    get_user_name(id,name,31) 
    if(containi(said,"/afk") != -1) 
    { 
      if (is_user_alive(id))
      { 
        cs_get_user_model(id,model[id],4)//How do I use this?
        team[id] = get_user_team(id)
	user_kill(id) 
        client_print(0,print_chat,"*DEAD* %s : I'll be back...",name) 
        client_cmd(id,"jointeam 6")    
      }  
  
   }
   if(containi(said,"/back") != -1) 
   { 
       
     client_print(0,print_chat,"%s : I'm back....",name) 
     if(team[id] == 1)
        client_cmd(id,"jointeam 1")    
     else
        client_cmd(id,"jointeam 2")
     cs_set_user_model(id,model[id])//Need help here too.
   }  
}
Thank you for your time.
twistedeuphoria is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 17:05  
Reply With Quote #2

Change length to 32.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-29-2004 , 17:07  
Reply With Quote #3

On what the get_user_name?
twistedeuphoria is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 17:09  
Reply With Quote #4

No, cs_get_user_model.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-29-2004 , 23:21  
Reply With Quote #5

Well I changed that...let me clarify what is happening. Someone will type /afk as a CT then some time later type /back and they will join the CT side. But, if a T says /afk then /back they will join the CT side.
twistedeuphoria is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-29-2004 , 23:38  
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new afk_team[32] new afk_model[32][32] public plugin_init() {     register_plugin("AFK and Back","0.1","twistedeuphoria")     register_clcmd("say","say_event")     return PLUGIN_CONTINUE } public say_event(id) {   new said[192] read_args(said,191) new name[32] get_user_name(id,name,31) if(containi(said,"afk") != -1) {     if (is_user_alive(id))     {         cs_get_user_model(id,afk_model[id],31)         afk_team[id] = get_user_team(id)         user_kill(id,1)         client_print(0,print_chat,"*DEAD* %s : I'll be back...",name)         client_cmd(id,"jointeam 6")     } } else if(containi(said,"back") != -1) {     client_print(0,print_chat,"%s : I'm back...",name)     if(afk_team[id] == 1)         client_cmd(id,"jointeam 1")     else         client_cmd(id,"jointeam 2")     client_cmd(id,"wait")     client_cmd(id,"slot5")     cs_set_user_model(id,afk_model[id]) } return PLUGIN_CONTINUE }
KRoT@L is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-30-2004 , 01:03  
Reply With Quote #7

Thank you very much! But, it wont "slot 5", is there not enough wait time or what?
twistedeuphoria is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-30-2004 , 01:38  
Reply With Quote #8

I tried on my computer and slot5 was executed, but if it doesn't work with you, just add some more
Code:
client_cmd(id,"wait")
until it works ;)
KRoT@L is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-30-2004 , 13:05  
Reply With Quote #9

My computer hates me . I put 50 of them and it still doesn't work. =_= Something else maybe?

Could you post your .amx and .sma that worked?
twistedeuphoria is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-30-2004 , 13:51  
Reply With Quote #10

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new afk_team[32] new afk_model[32][32] public plugin_init() {     register_plugin("AFK and Back","0.1","twistedeuphoria")     register_clcmd("say","say_event")     return PLUGIN_CONTINUE } public say_event(id) {   new said[192] read_args(said,191) new name[32] get_user_name(id,name,31) if(containi(said,"afk") != -1) {     if (is_user_alive(id))     {         cs_get_user_model(id,afk_model[id],31)         afk_team[id] = get_user_team(id)         user_kill(id,1)         client_print(0,print_chat,"*DEAD* %s : I'll be back...",name)         client_cmd(id,"jointeam 6")     } } else if(containi(said,"back") != -1) {     client_print(0,print_chat,"%s : I'm back...",name)     new playerVGUI[2]     get_user_info(id,"_vgui_menus",playerVGUI,1)     if (playerVGUI[0] != '0')     {         set_user_info(id,"_vgui_menus","0")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"wait")         if(afk_team[id] == 1)             client_cmd(id,"jointeam 1")         else             client_cmd(id,"jointeam 2")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"slot5")         set_task(2.0, "set_vgui", id)     }     else     {         if(afk_team[id] == 1)             client_cmd(id,"jointeam 1")         else             client_cmd(id,"jointeam 2")         client_cmd(id,"wait")         client_cmd(id,"wait")         client_cmd(id,"slot5")     }     cs_set_user_model(id,afk_model[id]) } return PLUGIN_CONTINUE } public set_vgui(id) {     set_user_info(id,"_vgui_menus","1") }
KRoT@L 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 17:14.


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