Raised This Month: $51 Target: $400
 12% 

[REQ] Random Deagle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blanko
Senior Member
Join Date: Aug 2008
Old 04-13-2016 , 18:26   [REQ] Random Deagle
Reply With Quote #1

At each roundstart, one random player will receive a desert eagle for free. +full ammo for deagle
__________________

Last edited by blanko; 04-13-2016 at 18:31.
blanko is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-13-2016 , 20:38   Re: [REQ] Random Deagle
Reply With Quote #2

Here's:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
 
#define PLUGIN "Random deagle"
#define VERSION "1.0"
#define AUTHOR "EFFx"
 
public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
register_event("ResetHUD""GiveDeagle""b"
}
public 
GiveDeagle()
{
 new 
players[32],iNum,random_player
 get_players
(players,iNum)
 
random_player players[random(iNum)]
 new 
szName[33]
 
get_user_name(random_player,szName,32)
 if(
is_user_alive(random_player))
 {
  
give_item(random_player,"weapon_deagle")
  
cs_set_user_bpammo(random_player,CSW_DEAGLE,35)
 }
 
client_print(0,print_chat,"[AMXX]: Random player is %s. He've received a eagle + full ammo",szName)

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-14-2016 at 13:04.
EFFx is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-14-2016 , 10:42   Re: [REQ] Random Deagle
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
Here's:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
 
#define PLUGIN "Random deagle"
#define VERSION "1.0"
#define AUTHOR "EFFx"
 
public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
RegisterHam(Ham_Spawn,"player","GiveDeagle",1)
}
public 
GiveDeagle()
{
 new 
players[32],iNum,random_player
 get_players
(players,iNum)
 
random_player players[random(iNum)]
 new 
szName[33]
 
get_user_name(random_player,szName,32)
 if(
is_user_alive(random_player))
 {
  
give_item(random_player,"weapon_deagle")
  
cs_set_user_bpammo(random_player,CSW_DEAGLE,35)
 }
 
client_print(0,print_chat,"[AMXX]: Random player is %s. He've received a eagle + full ammo",szName)

You have no ideea what you are doing, don't you?
__________________
HamletEagle is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-14-2016 , 12:28   Re: [REQ] Random Deagle
Reply With Quote #4

GiveDeagle() will be executed for every player spawn ...
EpicMonkey is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-14-2016 , 13:04   Re: [REQ] Random Deagle
Reply With Quote #5

Oh sorry, try now
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-14-2016 , 13:33   Re: [REQ] Random Deagle
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

public plugin_init()
{
    
register_plugin("Random Deagle""1.0""OciXCrom")
    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
eventRoundStart()
{
    new 
iPlayers[32], iPnum
    get_players
(iPlayersiPnum"a")
    
    if(!
iPnum)
        return
    
    new 
id iPlayers[random(iPnum)]
    
    if(
id && is_user_alive(id))
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
        
client_print(0print_chat"[Random Deagle] The random player this round is %s"szName)
    }

OciXCrom is offline
Send a message via Skype™ to OciXCrom
blanko
Senior Member
Join Date: Aug 2008
Old 04-14-2016 , 20:45   Re: [REQ] Random Deagle
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

public plugin_init()
{
    
register_plugin("Random Deagle""1.0""OciXCrom")
    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
eventRoundStart()
{
    new 
iPlayers[32], iPnum
    get_players
(iPlayersiPnum"a")
    
    if(!
iPnum)
        return
    
    new 
id iPlayers[random(iPnum)]
    
    if(
id && is_user_alive(id))
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
        
client_print(0print_chat"[Random Deagle] The random player this round is %s"szName)
    }

Thank you! I don't know to change the message color, is it possible?
__________________
blanko is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-14-2016 , 21:23   Re: [REQ] Random Deagle
Reply With Quote #8

Just add colorchat include or stock:

PHP Code:
stock ChatColor(const id, const input[], any:...) 
{
 new 
count 1players32 ]
 static 
msg191 ]
 
vformatmsg190input)
   
 
replace_allmsg190"!g""^4" )
 
replace_allmsg190"!y""^1" )
 
replace_allmsg190"!t""^3" )
   
 if(
idplayers] = id; else get_playersplayerscount"ch" )
 {
  for(new 
0counti++)
  {
   if( 
is_user_connectedplayers] ) )
   {
    
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
    
write_byteplayers] )
    
write_stringmsg )
    
message_end( )
   }
  }
 }

PHP Code:
ChatColor(0,"!g[Random Deagle]!y The random player in this round is!g %s",szName
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
blanko
Senior Member
Join Date: Aug 2008
Old 04-15-2016 , 01:39   Re: [REQ] Random Deagle
Reply With Quote #9

Oh, I forgot something very important: drop the current pistol before giving the random deagle.
__________________
blanko is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-15-2016 , 09:01   Re: [REQ] Random Deagle
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <colorchat>
#include <cstrike>
#include <fun>
#include <stripweapons>

public plugin_init()
{
    
register_plugin("Random Deagle""1.1""OciXCrom")
    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
eventRoundStart()
{
    new 
iPlayers[32], iPnum
    get_players
(iPlayersiPnum"a")
    
    if(!
iPnum)
        return
    
    new 
id iPlayers[random(iPnum)]
    
    if(
id && is_user_alive(id))
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
StripWeapons(idSecondary)
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
        
ColorChat(0TEAM_COLOR"^4[Random Deagle] ^1The random player this round is ^3%s"szName)
    }

colorchat.inc, stripweapons.inc

Last edited by OciXCrom; 04-15-2016 at 09:04.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 04:44.


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