Well I'm back with a fixed team script.This script had many bugs to solve but now it works perfectly for me. FJose update your script with this or atleast take a good look at your's because you're forgetting to do something important in the team cmd.Your FindPlr wasn't working for me so I had to use FindPlayer and I also edit some other lines of code.This is the code :
Waiting for replies
Code Select
else if ( cmd == "team" )
{
if ( !text ) MessagePlayer2( "Syntax: /team <player name or id>", player );
local plr = FindPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer2( "[Error] Unknown player.", player );
else if ( pinfo[ player.ID ].Team == true ) MessagePlayer2( "[Error] You already are in team.", player );
else if ( pinfo[ plr.ID ].Team == true ) MessagePlayer2( "[Error] " + plr.Name + " is already in team.", player );
else if ( pinfo[ player.ID ].Request == true ) MessagePlayer2( "[Error] You already have a request.", player );
else if ( pinfo[ plr.ID ].Request == true ) MessagePlayer2( "[Error] " + plr.Name + " already have a request.", player );
else
{
if ( pinfo[ player.ID ].TimeRequest < time() ) {
pinfo[ player.ID ].Request = false; pinfo[ player.ID ].Partner = null; pinfo[ player.ID ].TimeRequest = 0;
pinfo[ plr.ID ].Request = false; pinfo[ plr.ID ].Partner = null; pinfo[ plr.ID ].TimeRequest = 0;
}
MessagePlayer2( "" + player.Name + " would like to team up with you.", plr );
MessagePlayer2( "Request submitted.", player );
pinfo[ player.ID ].Partner = plr.Name;
pinfo[ plr.ID ].Partner = player.Name;
pinfo[ player.ID ].TimeRequest = time() + 30;
pinfo[ plr.ID ].TimeRequest = time() + 30;
pinfo[ plr.ID ].Request = true;
pinfo[ player.ID ].Request = true
}
}
else if ( cmd == "accept" )
{
local plr = FindPlayer( pinfo[ player.ID ].Partner );
if ( pinfo[ player.ID ].Request == false ) MessagePlayer2( "[Error] You don't have a request.", player );
else if ( pinfo[ player.ID ].Team == true ) MessagePlayer2( "[Error] You already have a team-mate.", player );
else
{
if ( pinfo[ player.ID ].TimeRequest < time() ) {
MessagePlayer2( "[Error] Time ended.", player );
pinfo[ player.ID ].Request = false;
pinfo[ player.ID ].Partner = null;
pinfo[ plr.ID ].Request = false;
pinfo[ plr.ID ].Partner = null;
pinfo[ player.ID ].TimeRequest = 0;
pinfo[ plr.ID ].TimeRequest = 0;
} else {
MessagePlayer2( "[!] " + player.Name + " is doing team with you.", player );
MessagePlayer2( "Request Accepted! You are now teaming with " + plr.Name, player );
pinfo[ player.ID ].Team = true;
pinfo[ plr.ID ].Team = true;
pinfo[ player.ID ].Request = false;
pinfo[ plr.ID ].Request = false;
pinfo[ player.ID ].TimeRequest = 0;
pinfo[ plr.ID ].TimeRequest = 0;
player.Pos = plr.Pos;
}
}
}
else if ( cmd == "deny" )
{
local plr = FindPlayer( pinfo[ player.ID ].Partner );
if ( pinfo[ player.ID ].Request == false ) MessagePlayer2( "[Error] You don't have a request.", player );
else
{
if ( pinfo[ player.ID ].TimeRequest < time() ) {
MessagePlayer2( "[Error] Time ended.", player );
pinfo[ player.ID ].Request = false;
pinfo[ plr.ID ].Request = false;
pinfo[ player.ID ].Partner = null;
pinfo[ plr.ID ].Partner = null;
pinfo[ player.ID ].TimeRequest = 0;
pinfo[ plr.ID ].TimeRequest = 0;
}
MessagePlayer2( "[!] " + plr.Name + " denied your request.", player );
MessagePlayer2( "Request Denied.", player );
pinfo[ player.ID ].Request = false;
pinfo[ plr.ID ].Request = false;
pinfo[ player.ID ].TimeRequest = 0;
pinfo[ plr.ID ].TimeRequest = 0;
}
}
else if ( cmd == "leave" )
{
local plr = FindPlayer( pinfo[ player.ID ].Partner );
if ( pinfo[ player.ID ].Team == false ) MessagePlayer2( "[Error] You don't have team.", player );
else
{
MessagePlayer2( "[!] " + player.Name + " left the team.", player );
MessagePlayer2( "[!] " + player.Name + " left the team.", pinfo[ player.ID ].Partner );
pinfo[ player.ID ].Team = false;
pinfo[ plr.ID ].Team = false;
pinfo[ player.ID ].Partner = null;
pinfo[ plr.ID ].Partner = null;
}
}
Waiting for replies