AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Respawn Team Toucher (https://forums.alliedmods.net/showthread.php?t=301114)

Saint Sinner 09-08-2017 14:38

Respawn Team Toucher
 
I want to execute respawn only for different team can someone help me?

For example : if toucheR team tero touch toucheD team tero get a toucheR respawn

This code respawn all touchers

Code:

#include < amxmodx >
#include < engine >
#include <hamsandwich>

new gOldTouch[33][33]
new Float:gDiff = 0.1
public plugin_init( )
{
    register_plugin( "touch team", "1.0", "code" );
    register_touch("player","player","fn_PlayerTouchPlayer");
}
public fn_PlayerTouchPlayer(ToucheR_id,ToucheD_id)
{
    if(get_systime() - gOldTouch[ToucheR_id][ToucheD_id] > gDiff || (get_systime() - gOldTouch[ToucheD_id][ToucheR_id] > gDiff))
    {
        gOldTouch[ToucheR_id][ToucheD_id] = get_systime()
        gOldTouch[ToucheD_id][ToucheR_id] = get_systime()
       
        ExecuteHamB(Ham_CS_RoundRespawn, ToucheR_id)
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}


kristi 09-08-2017 17:13

Re: Respawn Team Toucher
 
Post in requests section
Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <cstrike>

new gOldTouch[33][33]
new const Float:gDiff = 0.1
public plugin_init( )
{
    register_plugin( "touch team", "1.0", "code" );
    register_touch("player","player","fn_PlayerTouchPlayer");
}
public fn_PlayerTouchPlayer(ToucheR_id,ToucheD_id)
{
    if(cs_get_user_team(ToucheR_id) != cs_get_user_team(ToucheD_id))
        return PLUGIN_CONTINUE;

    if(get_systime() - gOldTouch[ToucheR_id][ToucheD_id] > gDiff || (get_systime() - gOldTouch[ToucheD_id][ToucheR_id] > gDiff))
    {
        gOldTouch[ToucheR_id][ToucheD_id] = get_systime()
        gOldTouch[ToucheD_id][ToucheR_id] = get_systime()
       
        ExecuteHamB(Ham_CS_RoundRespawn, ToucheR_id)
    }
    return PLUGIN_CONTINUE
}


siriusmd99 09-10-2017 07:44

Re: Respawn Team Toucher
 
Kristi, use ==
not !=

He wants to respawn players which have different team.
Also
PHP Code:

 new Float:gDiff 0.1 

:arrow:

PHP Code:

new const Float:gDiff 0.1 

Quite logic here, you are only reading it, not changing its value, so it would be better to define it as constant variable.


All times are GMT -4. The time now is 09:56.

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