This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved To teleport the entire team to the coordinates I specified


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vres
Junior Member
Join Date: Dec 2023
Location: Turkey
Old 05-11-2024 , 21:07   To teleport the entire team to the coordinates I specified
Reply With Quote #1

Greetings to everyone, my issue is as follows: I've created coordinates equal to the number of player slots on a specific map, and I'm aiming to teleport players to these coordinates, but it's not working properly. Thank you in advance for your help.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>

new Float:pozCT[10][3] =
{
    {-312.9, 443.24, -469.18 },
    {-184.9, 443.24, -469.18 },
    {-56.9, 443.24, -469.18 },
    {71.1, 443.24, -469.18 },
    {199.1, 443.24, -469.18 },
    {-312.9, 315.24, -469.18 },
    {-184.9, 315.24, -469.18 },
    {-56.9, 315.24, -469.18 },
    {71.1, 315.24, -469.18 },
    {199.1, 315.24, -469.18 }
};

new Float:pozTT[10][3] =
{
    {-312.9, -964.76, -469.18 },
    {-184.9, -964.76, -469.18},
    {-56.9, -964.76, -469.18},
    {71.1, -964.76, -469.18},
    {199.1, -964.76, -469.18},
    {-312.9, -836.76, -469.18},
    {-184.9, -836.76, -469.18},
    {-56.9, -836.76, -469.18},
    {71.1, -836.766, -469.18},
    {199.1, -836.76, -469.18}
};

new Float:angelCT[3] = {0.0, 270.0, 0.0 };
new Float:angelTT[3] = {0.0, 90.0, 0.0 };

new Float:vel[3] = {0.0, 0.0, 0.0 };

public plugin_init() {
    register_plugin("tele", "1.0", "Author")
    register_clcmd("say /knife", "cmdKnife")
}



public cmdKnife(id)
{
    
    new players[ 32 ], players_count
    new TT = 0, CT = 0
    get_players( players, players_count )
    for( new i; i < players_count; i++ )
    {
        switch( get_user_team( i ) )
        {
            case 1:
            {
                TT++
		engfunc(EngFunc_SetOrigin, i , pozTT[i]);
		set_pev(i, pev_angles, angelTT);
		set_pev(i, pev_fixangle, 1);
		set_user_velocity(i,vel)
            }
            case 2:
            {
                CT++
		engfunc(EngFunc_SetOrigin, i , pozCT[i]);
		set_pev(i, pev_angles, angelCT);
		set_pev(i, pev_fixangle, 1);
		set_user_velocity(i,vel)
            }
        }
    }
    
}

Last edited by vres; 05-12-2024 at 05:07.
vres is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-11-2024 , 21:53   Re: To teleport the entire team to the coordinates I specified
Reply With Quote #2

Quote:
Originally Posted by vres View Post
Greetings to everyone, my issue is as follows: I've created coordinates equal to the number of player slots on a specific map, and I'm aiming to teleport players to these coordinates, but it's not working properly. Thank you in advance for your help.
Here:

PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_MaxPlayers

new Float:pozCT[10][3] =
{
    {-
312.9443.24, -469.18 },
    {-
184.9443.24, -469.18 },
    {-
56.9443.24, -469.18 },
    {
71.1443.24, -469.18 },
    {
199.1443.24, -469.18 },
    {-
312.9315.24, -469.18 },
    {-
184.9315.24, -469.18 },
    {-
56.9315.24, -469.18 },
    {
71.1315.24, -469.18 },
    {
199.1315.24, -469.18}
};

new 
Float:pozTT[10][3] =
{
    {-
312.9, -964.76, -469.18 },
    {-
184.9, -964.76, -469.18},
    {-
56.9, -964.76, -469.18},
    {
71.1, -964.76, -469.18},
    {
199.1, -964.76, -469.18},
    {-
312.9, -836.76, -469.18},
    {-
184.9, -836.76, -469.18},
    {-
56.9, -836.76, -469.18},
    {
71.1, -836.766, -469.18},
    {
199.1, -836.76, -469.18}
};

new 
Float:angelCT[3] = {0.0270.00.0 };
new 
Float:angelTT[3] = {0.090.00.0 };

new 
Float:vel[3] = {0.00.00.0 };

public 
plugin_init()
{
    
register_plugin("tele""1.0""Author")
    
register_clcmd("say /knife""cmdKnife")

    
g_MaxPlayers get_maxplayers()
}

public 
cmdKnife(id)
{
    new 
TT 0CT 0
    
for(new ig_MaxPlayersi++)
    {
        if(
is_user_connected(i) && is_user_alive(i))
        {
            switch(
get_user_team(i))
            {
                case 
1:
                {
                    
set_pev(ipev_originpozTT[TT]);
                    
set_pev(ipev_anglesangelTT);
                    
set_pev(ipev_fixangle1);
                    
set_pev(ipev_velocityvel);
                    
TT++
                }
                case 
2:
                {
                    
set_pev(ipev_originpozCT[CT]);
                    
set_pev(ipev_anglesangelCT);
                    
set_pev(ipev_fixangle1);
                    
set_pev(ipev_velocityvel);
                    
CT++
                }
            }
        }
    }

Keep in mind that depending on the set server slots the variables CT and TT in CmdKnife can become bigger than 9 in which case the plugin will throw an error. To fix it either add more teleport points (16 for each team) or use this:
PHP Code:
            switch(get_user_team(i))
            {
                case 
1:
                {
                    if(
TT 10)
                    {
                        
set_pev(ipev_originpozTT[TT]);
                        
set_pev(ipev_anglesangelTT);
                        
set_pev(ipev_fixangle1);
                        
set_pev(ipev_velocityvel);
                        
TT++
                    }
                }
                case 
2:
                {
                    if(
CT 10)
                    {
                        
set_pev(ipev_originpozCT[CT]);
                        
set_pev(ipev_anglesangelCT);
                        
set_pev(ipev_fixangle1);
                        
set_pev(ipev_velocityvel);
                        
CT++
                    }
                }
            } 

Last edited by v120kaaimcfg; 05-11-2024 at 21:54.
v120kaaimcfg is offline
vres
Junior Member
Join Date: Dec 2023
Location: Turkey
Old 05-12-2024 , 05:05   Re: To teleport the entire team to the coordinates I specified
Reply With Quote #3

Quote:
Originally Posted by v120kaaimcfg View Post
Here:

PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_MaxPlayers

new Float:pozCT[10][3] =
{
    {-
312.9443.24, -469.18 },
    {-
184.9443.24, -469.18 },
    {-
56.9443.24, -469.18 },
    {
71.1443.24, -469.18 },
    {
199.1443.24, -469.18 },
    {-
312.9315.24, -469.18 },
    {-
184.9315.24, -469.18 },
    {-
56.9315.24, -469.18 },
    {
71.1315.24, -469.18 },
    {
199.1315.24, -469.18}
};

new 
Float:pozTT[10][3] =
{
    {-
312.9, -964.76, -469.18 },
    {-
184.9, -964.76, -469.18},
    {-
56.9, -964.76, -469.18},
    {
71.1, -964.76, -469.18},
    {
199.1, -964.76, -469.18},
    {-
312.9, -836.76, -469.18},
    {-
184.9, -836.76, -469.18},
    {-
56.9, -836.76, -469.18},
    {
71.1, -836.766, -469.18},
    {
199.1, -836.76, -469.18}
};

new 
Float:angelCT[3] = {0.0270.00.0 };
new 
Float:angelTT[3] = {0.090.00.0 };

new 
Float:vel[3] = {0.00.00.0 };

public 
plugin_init()
{
    
register_plugin("tele""1.0""Author")
    
register_clcmd("say /knife""cmdKnife")

    
g_MaxPlayers get_maxplayers()
}

public 
cmdKnife(id)
{
    new 
TT 0CT 0
    
for(new ig_MaxPlayersi++)
    {
        if(
is_user_connected(i) && is_user_alive(i))
        {
            switch(
get_user_team(i))
            {
                case 
1:
                {
                    
set_pev(ipev_originpozTT[TT]);
                    
set_pev(ipev_anglesangelTT);
                    
set_pev(ipev_fixangle1);
                    
set_pev(ipev_velocityvel);
                    
TT++
                }
                case 
2:
                {
                    
set_pev(ipev_originpozCT[CT]);
                    
set_pev(ipev_anglesangelCT);
                    
set_pev(ipev_fixangle1);
                    
set_pev(ipev_velocityvel);
                    
CT++
                }
            }
        }
    }

Keep in mind that depending on the set server slots the variables CT and TT in CmdKnife can become bigger than 9 in which case the plugin will throw an error. To fix it either add more teleport points (16 for each team) or use this:
PHP Code:
            switch(get_user_team(i))
            {
                case 
1:
                {
                    if(
TT 10)
                    {
                        
set_pev(ipev_originpozTT[TT]);
                        
set_pev(ipev_anglesangelTT);
                        
set_pev(ipev_fixangle1);
                        
set_pev(ipev_velocityvel);
                        
TT++
                    }
                }
                case 
2:
                {
                    if(
CT 10)
                    {
                        
set_pev(ipev_originpozCT[CT]);
                        
set_pev(ipev_anglesangelCT);
                        
set_pev(ipev_fixangle1);
                        
set_pev(ipev_velocityvel);
                        
CT++
                    }
                }
            } 

Thank you for your help You solved my problem.
vres is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:24.


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