AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Give to all/Give to one (https://forums.alliedmods.net/showthread.php?t=107722)

Brreaker 10-29-2009 14:40

Give to all/Give to one
 
Well...I have this plugin (Weird Round) and I want to do something like :
wr_status 1,everybody gets same power every round...
wr_status 2,everybody has different powers every round...
Now, I made the part with everybody gets the same power...But if I tried to make the second one, I get the "Undefinded symbol "id" " error...The part of code is like :
Code:

ublic eNewRound() {
        new status = get_pcvar_num(pCvarStatus)
        if(status == 1)
        {
                FirstStatus()
        }
        if(status == 2)
        {
                SecondStatus(id)
        }
       
        if(status == 0)
        {
                return PLUGIN_HANDLED
        }
       
        return PLUGIN_CONTINUE;
}

Status 1 public contains :
Code:

public FirstStatus() {
        new iRandomNum = random_num(0, 7)
        new gravity = get_pcvar_num(pCvarGrav)
        new speed = get_pcvar_num(pCvarSpeed)
        new frags = get_pcvar_num(pCvarFrags)
        new health = get_pcvar_num(pCvarHealth)
        new armor = get_pcvar_num(pCvarArmor)
        new deaths = get_pcvar_num(pCvarDeaths)
        new hgrav = get_pcvar_num(pCvarHGrav)
        new szPlayers[32], iCount, index
       
        get_players(szPlayers, iCount)
       
        for(new i=0; i < iCount; i++)
        {
                index = szPlayers[i]
        }
        switch(iRandomNum) {
        case 0: {
                        set_user_gravity(index, float(gravity))
                        client_print(0, print_chat, "Everybody Can Fly!")
                }
        case 1: {
                        set_user_maxspeed(index, float(speed))
                        client_print(0, print_chat, "Speed It Up!")
                }
        case 2: {
                        set_user_frags(index, frags)
                        client_print(0, print_chat, "Your Frags Were Modified!HaHa!")
                }
        case 3: {
                        set_user_health(index, health)
                        client_print(0, print_chat, "Everybody Is Living High!")
                }
        case 4: {
                        set_user_armor(index, armor)
                        client_print(0, print_chat, "You Got A Pretty Nice Armor!")
                }
        case 5: {
                        cs_set_user_deaths(index, deaths)
                        client_print(0, print_chat, "Your Deaths Were Modified!")
                }
        case 6: {
                        set_user_gravity(index, float(hgrav))
                        client_print(0, print_chat, "Nobody Can Jump Huh?")
                }
        case 7:                client_print(0, print_chat, "Nothing Happened!")
        }
}

Now what about SecondStatus?
At the line where the if function forwards to SecondStatus(id) I get the "Undefined symbol "id" "...

grimvh2 10-29-2009 17:53

Re: Give to all/Give to one
 
Dont understand it good, but

@

PHP Code:

for(new i=0iCounti++) 
{
        
index szPlayers[i]
}

// ur code 

is wrong, You are saving the last id that has been saved.
What this piece of code means is that your running true all players id's but it will only go trough that piece of code, once you closed it you will just use the last saved id.
Hope im a little clear

so it will be

PHP Code:

for(new i=0iCounti++) 
{
    
index szPlayers[i]
    switch(
iRandomNum) {
          case 
0: {
                 
set_user_gravity(indexfloat(gravity))
                 
client_print(0print_chat"Everybody Can Fly!")
         }
    }
        
// and on



Brreaker 10-30-2009 01:02

Re: Give to all/Give to one
 
Oh thx thx for that :D
MY mistake...An this is the part for giving everyone..I need a part that takes everyplayer and handles him a case :)


All times are GMT -4. The time now is 17:37.

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