Raised This Month: $ Target: $400
 0% 

Team Select Menu Customizer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CHE4TER
Member
Join Date: Jul 2013
Location: Portugal
Old 05-31-2014 , 15:04   Team Select Menu Customizer
Reply With Quote #1

What exatly I need, is create a function that will print in chat what team/class the player choosed.
At the end of this code you will se the "print_chat", it works fine, but how can I modify the class names? Default it shows as: Player joined gign, leet, sas... I want to rename that, possible?

PHP Code:
public class_menu_handler(idkey)
{
    new 
iMenuMsgid g_iMsgId[id];
    new 
iMsgBlock get_msg_block(iMenuMsgid);
    
set_msg_block(iMenuMsgidBLOCK_SET);
    
engclient_cmd(id"joinclass""1");
    
set_msg_block(iMenuMsgidiMsgBlock);

    
format(g_szPlayerModel[id], 127"%s"get_class_info(g_iUserTeam[id], keyCLASS_TAG));

    
//Auto-select
    
if(key == g_iCount[g_iUserTeam[id]])
        
get_random_class_tag(idg_iUserTeam[id], g_szPlayerModel[id], 127);

    
set_user_info(idMODELg_szPlayerModel[id]);
    
// see this
    
new szName[32]
    
get_user_name(idszNamecharsmax(szName)) 
    
client_print(0print_chat"%s as joined %s"szNameg_szPlayerModel[id])

    
g_bChanged[id] = true;


    return 
PLUGIN_HANDLED

CHE4TER is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-01-2014 , 06:30   Re: Team Select Menu Customizer
Reply With Quote #2

sure, make a switch(g_szPlayerModel[id])
case gign:
case leet:

etc..
aron9forever is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 06-01-2014 , 12:29   Re: Team Select Menu Customizer
Reply With Quote #3

cs_get_user_model gives 'gign', 'leet', if I remember right..
__________________
Retired.
Xalus is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-01-2014 , 12:37   Re: Team Select Menu Customizer
Reply With Quote #4

Quote:
Originally Posted by aron9forever View Post
sure, make a switch(g_szPlayerModel[id])
case gign:
case leet:

etc..
You cannot use a switch on a String
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-01-2014 , 13:40   Re: Team Select Menu Customizer
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
You cannot use a switch on a String
whatever, use a hundred ifs and else ifs then with equali
aron9forever is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 06-01-2014 , 17:11   Re: Team Select Menu Customizer
Reply With Quote #6

You can use switch on single cells of a string.
Code:
    new model[10];     cs_get_user_model(1, model, charsmax(model));         server_print("Model: %d/%s", GetCSModelIndex(model), model); } GetCSModelIndex(model[], CTOffset = 4) {     switch ( model[0] ) {         case 't': return 0; // Terror         case 'l': return 1; // Leet         case 'a': return 2; // Arctic         case 'u': return CTOffset + 0; // Urban         case 's': return CTOffset + 2; // SAS         case 'g': {             switch ( model[1] ) {                 case 'u': return 3; // Guerilla                 case 's': return CTOffset + 1; // GSG9                 case 'i': return CTOffset + 3; // GIGN                 default : return -1;             }         }     }     return -1; }
__________________
Black Rose 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 09:35.


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