AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Please Help... (https://forums.alliedmods.net/showthread.php?t=159826)

can1357 06-22-2011 02:52

Please Help...
 
I have a random weapon giver.
Code:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Rastgele Deagle Gelme"
#define VERSION "1.0"
#define AUTHOR "Optimist ( LockdowN )"
#define chance(%1) ( %1 > random(100) )  


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""FwdRoundStart""a")
}

public 
FwdRoundStart()
{
    if(
random(100) > 49)
    {
        new 
players[32], num
        get_players
(playersnum"ach")
        
        new 
id players[random(num)]
        
give_item(id"weapon_m4a1")
    
cs_set_user_bpammo(id,CSW_M4A1,555
        
give_item(id"weapon_mp5navy")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_MP5NAVY,555)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,555)
    }


in round start script will give one person weapon
but it not
and how can i give weapons only T persons
http://canproje.cc/error.bmp
PLEASE HELP ME SORY FOR MY BAD ENGLİSH

DarkGL 06-22-2011 12:11

Re: Please Help...
 
Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Rastgele Deagle Gelme"
#define VERSION "1.0"
#define AUTHOR "Optimist ( LockdowN )"


public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
}

public Poczatek_Rundy()
{
        new players[32], num
        get_players(players, num, "ac")
       
        new id = players[random(num)]
       
        if(!is_user_alive(id)){
                return PLUGIN_CONTINUE;
        }
       
        give_item(id, "weapon_m4a1")
        give_item(id, "weapon_mp5navy")
        give_item(id, "weapon_deagle")
        cs_set_user_bpammo(id,CSW_M4A1,555)
        cs_set_user_bpammo(id,CSW_MP5NAVY,555) 
        cs_set_user_bpammo(id,CSW_DEAGLE,555)
       
        return PLUGIN_CONTINUE;
}


drekes 06-22-2011 12:16

Re: Please Help...
 
@DarkGl: You don't have to check if he is alive because the "a" flag with get_players() only returns alive players.

DarkGL 06-23-2011 02:27

Re: Please Help...
 
sory
Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Rastgele Deagle Gelme"
#define VERSION "1.0"
#define AUTHOR "Optimist ( LockdowN )"


public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
}

public Poczatek_Rundy()
{
        new players[32], num
        get_players(players, num, "ac")
       
        new id = players[random(num)]
       
        give_item(id, "weapon_m4a1")
        give_item(id, "weapon_mp5navy")
        give_item(id, "weapon_deagle")
        cs_set_user_bpammo(id,CSW_M4A1,555)
        cs_set_user_bpammo(id,CSW_MP5NAVY,555) 
        cs_set_user_bpammo(id,CSW_DEAGLE,555)
       
        return PLUGIN_CONTINUE;
}


can1357 07-12-2011 10:10

Re: Please Help...
 
thanks


All times are GMT -4. The time now is 23:33.

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