AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to give an item only to Teror? (https://forums.alliedmods.net/showthread.php?t=108351)

grid1 11-04-2009 11:32

how to give an item only to Teror?
 
this code taken from a block maker mod (not the original [4.01])
original code
Code:

actionFlash(id, OverrideTimer)
{
    //get game time
    new Float:fTime = halflife_time();
   
    //make sure player is alive
    if (fTime >= gfFlashNextUse[id] || OverrideTimer)
    {
        give_item(id, "weapon_flashbang");
        {
            //omg
        }
   
        //set the time when the player can use the nuke again (someone might have been invincible)
        gfFlashNextUse[id] = fTime + get_cvar_float("bm_flashcooldown");
       
        //setup hud message to show who nuked what team
        set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
       
    }
    else
    {
        set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
        show_hudmessage(id, "FLASH BLOCK NEXT USE AFTER 1 ROUND", gfFlashNextUse[id] - fTime);
    }

i want to let only T team to get flash from the block
so i looked at the deagle block action

Code:

actionDeagle(id, OverrideTimer)
{
    //get game time
    new Float:fTime = halflife_time();
   
    //make sure player is alive
    if (fTime >= gfDeagleNextUse[id] || OverrideTimer)
    {
        if ( get_user_team ( id ) == 1 )
        {
        cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 1);
        }
   
        //set the time when the player can use the nuke again (someone might have been invincible)
        gfDeagleNextUse[id] = fTime + get_cvar_float("bm_deaglecooldown");
       
        //setup hud message to show who nuked what team
        set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
       
        //Show Message
        new szPlayerName[32];
        get_user_name(id, szPlayerName, 32);
           
        if ( get_user_team ( id ) == 1 )
        {
            show_hudmessage(0, "Oh My God, All CT's Run %s Got the Deagle!", szPlayerName);
        }
    }
    else
    {
        set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
        show_hudmessage(id, "DEAGLE NEXT USE AFTER 1 ROUND", gfDeagleNextUse[id] - fTime);
    }
}

and i take the code line that make what i want
so:
Code:

actionFlash(id, OverrideTimer)
{
    //get game time
    new Float:fTime = halflife_time();
   
    //make sure player is alive
    if (fTime >= gfFlashNextUse[id] || OverrideTimer)
    {
                if ( get_user_team ( id ) == 1 )
        {
        give_item(id, "weapon_flashbang");
        {
            //omg
        }
   
        //set the time when the player can use the nuke again (someone might have been invincible)
        gfFlashNextUse[id] = fTime + get_cvar_float("bm_flashcooldown");
       
        //setup hud message to show who nuked what team
        set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
       
    }
    else
    {
        set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
        show_hudmessage(id, "FLASH BLOCK NEXT USE AFTER 1 ROUND", gfFlashNextUse[id] - fTime);
    }
}

didnt work for me bah :S
what should i do?
sry for bad english and thx for help

hleV 11-04-2009 11:51

Re: how to give an item only to Teror?
 
PHP Code:

actionFlash(idOverrideTimer)
{
    if (
cs_get_user_team(id) != CS_TEAM_T)
        return;
 
    
// The code



grid1 11-04-2009 11:57

Re: how to give an item only to Teror?
 
like that?
Code:

actionFlash(id, OverrideTimer)
{
    //get game time
    new Float:fTime = halflife_time();
   
    //make sure player is alive
    if (fTime >= gfFlashNextUse[id] || OverrideTimer)
    {
                    if (cs_get_user_team(id) != CS_TEAM_T)
        return;
        {
        give_item(id, "weapon_flashbang");
        {
            //omg
        }
   
        //set the time when the player can use the nuke again (someone might have been invincible)
        gfFlashNextUse[id] = fTime + get_cvar_float("bm_flashcooldown");
       
        //setup hud message to show who nuked what team
        set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
       
    }
    else
    {
        set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
        show_hudmessage(id, "FLASH BLOCK NEXT USE AFTER 1 ROUND", gfFlashNextUse[id] - fTime);
    }
}

didnt work also

hleV 11-04-2009 12:10

Re: how to give an item only to Teror?
 
No.
PHP Code:

actionFlash(idOverrideTimer)
{
    if (
cs_get_user_team(id) != CS_TEAM_T)
        return;
 
    
//get game time
    
new Float:fTime halflife_time();
 
    
//make sure player is alive
    
if (fTime >= gfFlashNextUse[id] || OverrideTimer)
    {
        
give_item(id"weapon_flashbang");
 
        
//set the time when the player can use the nuke again (someone might have been invincible)
        
gfFlashNextUse[id] = fTime get_cvar_float("bm_flashcooldown");
 
        
//setup hud message to show who nuked what team
        
set_hudmessage(2552550, -1.00.3506.010.01.01.0);
 
    }
    else
    {
        
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
        
show_hudmessage(id"FLASH BLOCK NEXT USE AFTER 1 ROUND"gfFlashNextUse[id] - fTime);
    }



grid1 11-04-2009 13:48

Re: how to give an item only to Teror?
 
thanks you^
work fine now

grimvh2 11-04-2009 17:04

Re: how to give an item only to Teror?
 
Search here : http://www.amxmodx.org/doc/ at function references


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

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