Raised This Month: $ Target: $400
 0% 

Problems with Random player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-21-2010 , 14:49   Re: Problems with Random player
Reply With Quote #1

I am new in scripting, and i am learning. I know only the basic, but without this task, code doesn't work.

Last edited by eNz0; 05-21-2010 at 14:54.
eNz0 is offline
Hx7r
Member
Join Date: Mar 2009
Old 05-21-2010 , 15:12   Re: Problems with Random player
Reply With Quote #2

Code:
#include <amxmodx> #include <fun> public plugin_init() {     register_plugin("Random Player", "0.1", "padilha007")     register_logevent("logRound_Start", 2, "1=Round_Start"); } public logRound_Start() {     new player = GetRandomPlayer("a");     give_item(player, "weapon_m4a1") } GetRandomPlayer(const flags[]="", const teamORname[]="") {     new players[32], pnum;     get_players(players, pnum, flags, teamORname);         return (pnum > 0) ? players[random(pnum)] : 0; }
Hx7r is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2010 , 20:17   Re: Problems with Random player
Reply With Quote #3

Your problem is that you are giving a random player the weapon each time a new player spawns.
Hx7r's code should work how you want.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-22-2010 , 04:48   Re: Problems with Random player
Reply With Quote #4

How can i get random player from only 1 team (Terr)
eNz0 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-22-2010 , 05:31   Re: Problems with Random player
Reply With Quote #5

GetRandomPlayer( "ae", "TERRORIST" );
__________________
xPaw is offline
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-22-2010 , 07:56   Re: Problems with Random player
Reply With Quote #6

Thanks
eNz0 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 03:38.


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