Raised This Month: $ Target: $400
 0% 

Give to all/Give to one


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 10-29-2009 , 14:40   Give to all/Give to one
Reply With Quote #1

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" "...
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 10-29-2009 , 17:53   Re: Give to all/Give to one
Reply With Quote #2

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

__________________
I am out of order!
grimvh2 is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 10-30-2009 , 01:02   Re: Give to all/Give to one
Reply With Quote #3

Oh thx thx for that
MY mistake...An this is the part for giving everyone..I need a part that takes everyplayer and handles him a case
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Reply


Thread Tools
Display Modes

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:37.


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