AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Commands for Ts are executed on CTs (https://forums.alliedmods.net/showthread.php?t=154393)

Kia 04-07-2011 10:45

Commands for Ts are executed on CTs
 
Hello everybody,
I've got a problem with my menu, everything which should happen on the Ts happens on the CTs, I hope you can search the mistake and tell me whats wrong. :

PHP Code:

public submenuverstecken_handler(idmenuitem)
{
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            for (new 
user 1user <= gMaxPlayersuser++)
            {
                new 
CsTeams:Team;
                
Team cs_get_user_team(user);
                
                if (
Team == CS_TEAM_T)
                {
                    
set_user_maxspeed(id0)
                }
            }
        }
        case 
2:
        {
            for (new 
user 1user <= gMaxPlayersuser++)
            {
                new 
CsTeams:Team;
                
Team cs_get_user_team(user);
                
                if (
Team == CS_TEAM_T)
                {
                    
set_user_maxspeed(id,320)
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;



georgik57 04-07-2011 11:08

Re: Commands for Ts are executed on CTs
 
umm
try writing ct instead of t and see what happens?

Kia 04-07-2011 11:17

Re: Commands for Ts are executed on CTs
 
No changes...

// EDIT :

After using CT instead of T and then changing back to T, it worked. ö.o

Elusive138 04-07-2011 22:15

Re: Commands for Ts are executed on CTs
 
Well, firstly, use is_user_connected() or is_user_alive(), otherwise it'll error on the first non-existent id.

Also, since you're checking the team of all 'user's, set_user_maxspeed(id,320) should be set_user_maxspeed(user,320)?

ConnorMcLeod 04-08-2011 00:53

Re: Commands for Ts are executed on CTs
 
Lol, you loop though all players, and each time a single player match the team you check, you execute the code on the first player passed (id).

You don't understand what you do, you should start with more basic and easy code.

Kia 04-08-2011 16:46

Re: Commands for Ts are executed on CTs
 
Hmm...what code should I use instead?

EDIT :

Ok, got it.
PHP Code:

new CsTeams:team cs_get_user_team(id)
    if (
team == CS_TEAM_T)
    {
            
set_user_health(id1)
    } 


Kia 04-09-2011 09:02

Re: Commands for Ts are executed on CTs
 
mh, doesnt work, dont know, anyone know the right code?


All times are GMT -4. The time now is 19:48.

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