AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved PlayerSpawn Pre problems (https://forums.alliedmods.net/showthread.php?t=325505)

iceeedr 06-24-2020 16:23

PlayerSpawn Pre problems
 
Hello, I have a small problem with no solution so far, I registered playerspawn (ham) as pre and after checking the conditions I return SUPERCEDE the function.

The problem is that the player goes into "free camera" mode and I would like the camera to conform to the standard, which is to get killed with the spec camera on the team's players, I tried with set_view, but it seems that this was not the solution, any ideas?

PHP Code:

public PlayerSpawnPre(id)
{
        if(
condition)
        {
                return 
HAM_SUPERCEDE
        
}
        return 
HAM_IGNORED



HamletEagle 06-25-2020 03:55

Re: PlayerSpawn Pre problems
 
Do you want to prevent people from spawning on new round? If not, why are you blocking Spawn?

iceeedr 06-25-2020 08:46

Re: PlayerSpawn Pre problems
 
Quote:

Originally Posted by HamletEagle (Post 2707175)
Do you want to prevent people from spawning on new round? If not, why are you blocking Spawn?

Exactly! I want that round (if the requirements of the if condition are met) he doesn't spawn.

supertrio17 06-25-2020 10:18

Re: PlayerSpawn Pre problems
 
Hm, I get the point, I will try to find a way to overcome this issue.

supertrio17 06-25-2020 10:41

Re: PlayerSpawn Pre problems
 
1 Attachment(s)
You can try this, but I have no idea if it will work, so don't judge me.
PHP Code:

#include <amxmodx>
#include <fakemeta>

#if cellbits == 32
    #define OFFSET_TEAM 114
#else
    #define OFFSET_TEAM 139
#endif

const m_iTeam 114;
new 
g_Team[33]

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""PlayerSpawnPre"1);
}

public 
PlayerSpawnPre(id)
{
        if(
condition)
        {
            return 
HAM_SUPERCEDE
            g_Team
[id] = get_user_team(id)
            switch(
g_Team[id])
            {
                case 
1:
                {
                    
set_pdata_int(idOFFSET_TEAMTEAM_T);
                }
                case 
2:
                {
                    
set_pdata_int(idOFFSET_TEAMTEAM_CT);
                }
            }
        }
        return 
HAM_IGNORED
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    
g_Team[id] = 0


Edit:
I got the idea from admin_freelook.sma here

iceeedr 06-25-2020 10:52

Re: PlayerSpawn Pre problems
 
Quote:

Originally Posted by supertrio17 (Post 2707212)
You can try this, but I have no idea if it will work, so don't judge me.
PHP Code:

#include <amxmodx>
#include <fakemeta>

#if cellbits == 32
    #define OFFSET_TEAM 114
#else
    #define OFFSET_TEAM 139
#endif

const m_iTeam 114;
new 
g_Team[33]

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""PlayerSpawnPre"1);
}

public 
PlayerSpawnPre(id)
{
        if(
condition)
        {
            return 
HAM_SUPERCEDE
            g_Team
[id] = get_user_team(id)
            switch(
g_Team[id])
            {
                case 
1:
                {
                    
set_pdata_int(idOFFSET_TEAMTEAM_T);
                }
                case 
2:
                {
                    
set_pdata_int(idOFFSET_TEAMTEAM_CT);
                }
            }
        }
        return 
HAM_IGNORED
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    
g_Team[id] = 0


Edit:
I got the idea from admin_freelook.sma here

Thank you for your effort, but it was only necessary to change the player's spawn to 1 in TeamInfo so that the engine doesn't spawn him.

PHP Code:

set_member(idm_iNumSpawns1



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

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