| Ardonicek |
01-05-2014 15:16 |
[SOLVED] Teleport T team and CT team
Hello, i have a problem with script, i need to make players teleport to spawns on map by team (T = T Spawn , CT = CT Spawn)
I have this script, but doesn't do anything, if i set to teleport all players - not depending on team, it works, but not by team :(
Any help?
NOTE: For the "amx_teleport" script i'm using arkshine's script.
https://forums.alliedmods.net/showthread.php?t=75812
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
new gVoteMenu;
new gVotes[2];
new gVoting;
public plugin_init()
{
register_clcmd( "start_vote","StartVote" );
register_logevent("event_new_round", 2, "1=Round_Start");
}
public event_new_round(id)
{
set_task(0.1, "StartVote")
}
public StartVote( id )
{
gVotes[0] = gVotes[1] = 0;
gVoteMenu = menu_create( "\rLook at this Vote Menu!:", "menu_handler" );
menu_additem( gVoteMenu, "Knife Arena", "", 0 );
menu_additem( gVoteMenu, "Vote Option 2", "", 0 );
new players[32], pnum, tempid;
get_players( players, pnum );
for ( new i; i < pnum; i++ )
{
tempid = players[i];
menu_display( tempid, gVoteMenu, 0 );
gVoting++;
}
set_task(10.0, "EndVote" );
return PLUGIN_HANDLED;
}
public menu_handler( id, menu, item )
{
if ( item == MENU_EXIT || !gVoting )
{
return PLUGIN_HANDLED;
}
gVotes[ item ]++;
return PLUGIN_HANDLED;
}
public EndVote()
{
if ( gVotes[0] > gVotes[1] ) {
client_print(0, print_chat, "First option recieved most votes (%d )", gVotes[0] );
set_task(0.1, "knifeport")
}
else if ( gVotes[0] < gVotes[1] )
client_print(0, print_chat, "Second option recieved most votes (%d )", gVotes[1] );
else
client_print(0, print_chat, "The vote tied at %d votes each.", gVotes[0] );
menu_destroy( gVoteMenu );
gVoting = 0;
}
public knifeport(id)
{
if (is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
{
client_cmd(id, "amx_teleport -768 -352 256");
}
if (is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
{
client_cmd(id, "amx_teleport -1600 -352 256");
}
}
|