AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block T with Ham_Touch (https://forums.alliedmods.net/showthread.php?t=139783)

SaM.ThE.MaN 10-05-2010 07:12

Block T with Ham_Touch
 
Hi,

So i wanted to block T's from picking up weapons , this is what ive got ...
Example script :

public fw_TouchWeapon(weapon, id)
{
if ( !is_user_connected(id) )
return HAM_IGNORED;

if ( id && !is_user_bot(id) )
return HAM_SUPERCEDE;

return HAM_IGNORED;
}

well ... it blocks both T's and CTS from picking up weapons since i haven't ignored any teams ... i tried changing stuff like if cs_get_user_team is CT , then ignore , but it still did not work

abdul-rehman 10-05-2010 07:22

Re: Block T with Ham_Touch
 
Try putting this in ur script:
Code:
public fw_TouchWeapon(weapon, id) {     if ( !is_user_connected(id) )         return HAM_IGNORED;         if ( id && !is_user_bot(id) && cs_get_user_team(id) == CS_TEAM_T)         return HAM_SUPERCEDE;         return HAM_IGNORED; }

SaM.ThE.MaN 10-05-2010 08:05

Re: Block T with Ham_Touch
 
aww ... thanx man , it works , ... anyways i don't get it , how does this work ... i tried adding the get team thing separately , and it did not work , how come it works now

Hunter-Digital 10-05-2010 08:33

Re: Block T with Ham_Touch
 
Because, it shouldn't be separate., all conditions must be met to block the function.

I think this is how you did it:
Code:

public fw_TouchWeapon(weapon, id)
{
    if ( !is_user_connected(id) )
        return HAM_IGNORED;

    if ( id && !is_user_bot(id))
        return HAM_SUPERCEDE;

    if (cs_get_user_team(id) == CS_TEAM_T)
        return HAM_SUPERCEDE;

    return HAM_IGNORED;
}

That is wrong, since it will never reach the third if().

SaM.ThE.MaN 10-05-2010 09:36

Re: Block T with Ham_Touch
 
how come i never thought about it ... omg i even 4got the basics -.- grr..


All times are GMT -4. The time now is 10:20.

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