This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Randomly select a terrorist player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 11-29-2011 , 15:09   Randomly select a terrorist player
Reply With Quote #1

Hi all!

I want to randomly select a terrorist player (which is alive) and modify the value of a bool on that player but i couldn't figure it out...

PHP Code:
public Event_RoundStarted( )
{
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"a" );

    
//.........


Last edited by ROKronoS; 11-29-2011 at 15:11.
ROKronoS is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2011 , 17:31   Re: Randomly select a terrorist player
Reply With Quote #2

PHP Code:
new iPlayers[32], iNumiRandomPlayer;
get_players(iPlayersiNum"ae""TERRORIST");

iRandomPlayer iPlayers[random(iNum)]; 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Old 11-30-2011, 05:41
ROKronoS
This message has been deleted by ROKronoS. Reason: ...
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 12-01-2011 , 06:56   Re: Randomly select a terrorist player
Reply With Quote #3

Sorry for bumping but i get an index out of bounds error :-/

PHP Code:
public Event_RoundStarted( )
{
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""TERRORIST" );
    
    
g_stealerid iPlayersrandomiNum ) ]; // index out of bounds right on this line
    
    
g_giftstealerg_stealerid ] = true;

ROKronoS is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-01-2011 , 08:01   Re: Randomly select a terrorist player
Reply With Quote #4

Check if iNum > 0 before getting random player.
__________________
hleV is offline
Old 12-25-2011, 12:35
JoKeR LauGh
This message has been deleted by JoKeR LauGh.
Old 12-29-2011, 07:25
JoKeR LauGh
This message has been deleted by JoKeR LauGh.
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-29-2011 , 08:19   Re: Randomly select a terrorist player
Reply With Quote #5

Don't bump until 2 weeks have passed.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Old 12-29-2011, 08:39
JoKeR LauGh
This message has been deleted by JoKeR LauGh.
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 12-29-2011 , 09:10   Re: Randomly select a terrorist player
Reply With Quote #6

Quote:
Originally Posted by JoKeR LauGh View Post
http://forums.alliedmods.net/showthread.php?t=174773

#5 and #6 and still no one avoid him to do that so
And because he is breaking the rules & risking a locked thread or ban means you have to do it because ... ?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-29-2011 , 10:17   Re: Randomly select a terrorist player
Reply With Quote #7

Read the rules, bump before 2 weeks have passed is forbidden.

You have to wait.. If nobody answer, this is because nobody can help you/have time to help you.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Old 12-29-2011, 19:52
JoKeR LauGh
This message has been deleted by JoKeR LauGh.
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 12:57.


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