Raised This Month: $ Target: $400
 0% 

Choose random player from each team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-15-2017 , 18:14   Choose random player from each team
Reply With Quote #1

Need a code where a random player is chosen from each team and gets scout while others players can only use knife.

Thanks
__________________
Airkish is offline
generalmemer
Member
Join Date: Sep 2017
Old 09-15-2017 , 21:26   Re: Choose random player from each team
Reply With Quote #2

Quote:
Originally Posted by Airkish View Post
Need a code where a random player is chosen from each team and gets scout while others players can only use knife.

Thanks
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Random Player", "0.2", "Exolent");     register_concmd("amx_randomplayer", "concmd_RandomPlayer"); } public concmd_RandomPlayer(id) {     if(~get_user_flags(id) & ADMIN_BAN)         return PLUGIN_HANDLED;         stripweps()         static player1, player2;     static players[32], iPnum;     get_players(players, iPnum, "e", "TERRORIST");         player1 = players[random(iPnum)];         if(!player1)     {         console_print(id, "[AMXX] Random player not found.");         return PLUGIN_HANDLED;     }                 get_players(players, iPnum, "e", "CT");         player2 = players[random(iPnum)];         if(!player2)     {         console_print(id, "[AMXX] Random player not found.");         return PLUGIN_HANDLED;     }                 static sName[32];     static const iNameLen = sizeof(sName) - 1         get_user_name(player1, sName, iNameLen);     client_print(0, print_chat, "[AMXX] Random player for Terrorist will be %s.", sName);         get_user_name(player2, sName, iNameLen);     client_print(0, print_chat, "[AMXX] Random player for CT will be %s.", sName);         give_item(player1,"weapon_scout")     give_item(player2,"weapon_scout")     return PLUGIN_HANDLED; } stock stripweps() {     new Players[32], PlayersNum, id     get_players(Players, PlayersNum, "h")         for( new i; i < PlayersNum; i++ )     {         id = Players[i]                 if( is_user_connected(id) && is_user_alive(id) )         {             strip_user_weapons(id)             give_item(id,"weapon_knife")         }     } }

?
Attached Files
File Type: sma Get Plugin or Get Source (12345678.sma - 532 views - 1.5 KB)
generalmemer 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 13:54.


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