AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if player droped scout/weapon name (https://forums.alliedmods.net/showthread.php?t=183047)

bazhenov93 04-16-2012 12:41

Check if player droped scout/weapon name
 
Ok so I have this, but I need a check if the scout was droped, because the "Due to usage of weapon with..." is always when you drop and type /scout again._.

PHP Code:

public cmdScout(id)
{
    if(! 
is_user_alive(id) && is_user_connected(id))
    {
        
ColorChat(idBLUE,"You must be alive to use this function")
        return 
PLUGIN_HANDLED
    
}
    
    if(
user_has_weapon(idCSW_SCOUT))
    {
        
ColorChat(idBLUE"You already have a Scout")
        return 
PLUGIN_HANDLED
    
}
    
    if (
timer_started[id])
    {
        
cs_set_weapon_ammo(give_item(id"weapon_scout"), 0)
        
ColorChat(idBLUE"Due to usage of weapon with speed +250, you aren't able to get into Pro15 list")
        return 
PLUGIN_HANDLED
    
}
    
    if((
get_user_flags(id) & VIP ))
    {
        
cs_set_weapon_ammo(give_item(id"weapon_scout"), 90)
    }
    else
    {
        
cs_set_weapon_ammo(give_item(id"weapon_scout"), 0)
    }
    return 
PLUGIN_HANDLED



rak 04-16-2012 12:48

Re: Check if player droped scout/weapon name
 
you don't understand nothing no?; i give you the answer in spanish forum;


Quote:

Originally Posted by rak (Post 1689288)
register_clcmd("drop", "cmdDrop")

you need this.. and check if have scout.. very simple

bazhenov93 04-16-2012 12:53

Re: Check if player droped scout/weapon name
 
Quote:

Originally Posted by rak (Post 1690524)
you don't understand nothing no?; i give you the answer in spanish forum;



you need this.. and check if have scout.. very simple

using that way, the player can drop anything and will have that msg.

PHP Code:

new drop_id;


public 
plugin_init( ) {
    
register_concmd"drop""cmd_drop" );
    
register_touch"weaponbox""worldspawn""Fwd_Weapon_Touch" );
    
}

public 
cmd_drop(id) {
    if( !
is_user_alive(id) || !is_user_alive(id) ) {
        return;
    }
    
    new 
name35 ];
    
get_user_name(idname34 );
    
drop_id id;
}

public 
Fwd_Weapon_Touch(weaponworld) {
    
dropedf( );
}

public 
droped( ) {
    new 
name35 ];
    
get_user_name(drop_idname34 );
    
    
client_print0print_chat"A gun has been dropped by %s"name );
    


How to add only scout here :3:3:3:3:3

kramesa 04-16-2012 13:00

Re: Check if player droped scout/weapon name
 
This?

Code:
#include <amxmodx> #include <amxmisc> new bool:ClientDropedScout[33]; public plugin_init()     register_clcmd("drop", "CmdDrop"); public CmdDrop(id) {     if(is_user_alive(id)) {         new Weapon;         Weapon = get_user_weapon(id, _, _);                 if(Weapon == CSW_SCOUT) {             ClientDropedScout[id] = true;                         // Your code here.         }     } }

Exolent[jNr] 04-16-2012 13:01

Re: Check if player droped scout/weapon name
 
Why not just removed dropped weapons?

rak 04-16-2012 21:41

Re: Check if player droped scout/weapon name
 
Quote:

Originally Posted by Exolent[jNr] (Post 1690539)
Why not just removed dropped weapons?

not is more simple do this? xD

PHP Code:

public cmdScout(id)
{
    if(! 
is_user_alive(id) && is_user_connected(id))
    {
        
ColorChat(idBLUE,"You must be alive to use this function")
        return 
PLUGIN_HANDLED
    
}
    
    if(
user_has_weapon(idCSW_SCOUT))
    {
        
ColorChat(idBLUE"You already have a Scout")
        return 
PLUGIN_HANDLED
    
}
    
    if((
get_user_flags(id) & VIP ))
    {
        
cs_set_weapon_ammo(give_item(id"weapon_scout"), 90)
    }
    else
    {
        
cs_set_weapon_ammo(give_item(id"weapon_scout"), 0)
    }
    
    if (
timer_started[id])
    {
        
ColorChat(idBLUE"Due to usage of weapon with speed +250, you aren't able to get into Pro15 list")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED



Exolent[jNr] 04-16-2012 22:48

Re: Check if player droped scout/weapon name
 
Quote:

Originally Posted by rak (Post 1690783)
not is more simple do this? xD

He wants that if you have a scout, drop it, and type /scout that you will not get a new scout?
Or something like that because you can just spam scout entities.

rak 04-16-2012 23:53

Re: Check if player droped scout/weapon name
 
Quote:

Originally Posted by Exolent[jNr] (Post 1690815)
He wants that if you have a scout, drop it, and type /scout that you will not get a new scout?
Or something like that because you can just spam scout entities.

she's problem is( i suppouse ) don't give she the scout for vips when she drop his scout and write /scout.. sorry.. i know.. my english xD

bazhenov93 04-17-2012 11:35

Re: Check if player droped scout/weapon name
 
my problem is if (timer_started[id])

if you type scout, you get it.. you can get it every time, but every time you get a scout during a map time (kreedz) you got that message "Due to usage of weapon with speed +250, you ar....." I want this message only for 1 time..

and sorry for english too :P

Exolent[jNr] 04-17-2012 13:00

Re: Check if player droped scout/weapon name
 
Add another variable
PHP Code:

new bool:shown_scout_message[33];

// when timer starts
shown_scout_message[id] = false;

// when player gets scout
if(timer_started[id]) {
    if(!
shown_scout_message[id]) {
        
client_print(idprint_chat"yada yada");
        
shown_scout_message[id] = true;
    }




All times are GMT -4. The time now is 07:43.

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