AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Prevent spawning on second connect (https://forums.alliedmods.net/showthread.php?t=192262)

striker07 08-08-2012 07:14

Prevent spawning on second connect
 
How can i prevent the game from spawning a person when he joins the server a second time and more in the same map?

PHP Code:

public plugin_init()
{
    
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Pre"1);
}
 
public 
client_connect(id)
{
    
g_iPlayed[id]++;
}
 
public 
Fwd_PlayerSpawn_Pre(id)
{
     if(
g_iPlayed >=2)
         return 
PLUGIN_HANDLED;


will this work or do i have to silentkill the user after he spawned?

hleV 08-08-2012 08:52

Re: Prevent spawning on second connect
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

//#define RESET_ON_NEW_ROUND

new Trie:SteamIds;

public 
plugin_init()
{
#if defined RESET_ON_NEW_ROUND
    
register_event("HLTV""OnHltv""a""1=0""2=0");
#endif

    
SteamIds TrieCreate();
}

public 
plugin_end()
    
TrieDestroy(SteamIds);

public 
client_putinserver(client)
{
    new 
steamId[35];
    
get_user_authid(clientsteamIdcharsmax(steamId));
    
    if (
TrieKeyExists(SteamIdssteamId))
        
set_pdata_int(client3651);
    else
        
TrieSetCell(SteamIdssteamIdtrue);
}

#if defined RESET_ON_NEW_ROUND
public OnHltv()
    
TrieClear(SteamIds);
#endif 


striker07 08-08-2012 12:33

Re: Prevent spawning on second connect
 
thanks alot :)
gj

striker07 01-02-2014 13:47

Re: Prevent spawning on second connect
 
How can i allow players that joined the server, immediatly spawn the first time they are connecting since the map started.
using this code so that when there are connecting a second time during the same map they wont be spawned

Backstabnoob 01-02-2014 13:58

Re: Prevent spawning on second connect
 
try to uncomment the define

striker07 01-02-2014 17:46

Re: Prevent spawning on second connect
 
nono, this function was made for when the server has the function i actually need.
I need to let players spawn into the game after they chose their team after they joined the game for the first time since the start of the map


All times are GMT -4. The time now is 05:48.

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