Team System v1.0.2

Started by Fjose, Oct 21, 2014, 03:16 AM

Previous topic - Next topic

Drake

Ok then see the Error yourself....   

When I type "/team kra  [Player's Name]   or   0  [Player's ID]





Line 921 is :

if ( status[ player.ID ].TimeRequest < time() )

Full Code of team is

else if ( cmd == "team" )
    {
  local plr = FindPlr( GetTok( text, " ", 1 ) );
  if ( status[ player.ID ].Team == true ) PrivMessage( player, "[Error] You already are in team." );
  else if ( !text ) PrivMessage( player, "Syntax: /team <player name or id>" );
  else if ( !plr ) PrivMessage( player, "[Error] Unknown player." );
  else if ( status[ plr.ID ].Team == true ) PrivMessage( player, "[Error] " + plr.Name + " is already in team." );
  else if ( status[ player.ID ].Request == true ) PrivMessage( player, "[Error] You already have a request." );
  else if ( status[ plr.ID ].Request == true ) PrivMessage( player, "[Error] " + plr.Name + " already have a request." );
  else
  {
   if ( status[ player.ID ].TimeRequest < time() )
   {
    status[ player.ID ].Request = false; status[ player.ID ].Partner = null;  status[ player.ID ].TimeRequest = 0;
    status[ plr.ID ].Request = false; status[ plr.ID ].Partner = null; status[ plr.ID ].TimeRequest = 0;
   }
   
   PrivMessage( plr, "[!] " + player.Name + " would like to team up with you." );
   PrivMessage( player, "Request submitted." );
   status[ player.ID ].Partner = plr.ID;
   status[ plr.ID ].Partner = player.ID;
   status[ player.ID ].TimeRequest = time() + 30;
   status[ plr.ID ].TimeRequest = time() + 30;
  }
 }


Fjose

I think it I have the solution but first.

post the line 912 of onplayercommand and the 289 of gettok.

note: are you sure that you have added the timerequest as is written? post your class too. maybe the error is in the class

Honey

#17
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 :

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 :)

Fjose

ok thanks honey,

rarely.. I never had a problem with the FindPlr

Drake

Which plugins contains time(). Function?

.

.

Fjose

Quote from: KraTO$ on Oct 27, 2014, 06:25 PMWhich plugins contains time(). Function?

squirrel plugin as said S.L.C. anyway you can try the code fixed by honey. still I have my doubts of why the script had that problem but for now I'll update the code wih the code of honey.

Drake

I think my plugins are not correct....please give the plugins you have..

soulshaker

Quote from: KraTO$ on Oct 28, 2014, 01:38 AMI think my plugins are not correct....please give the plugins you have..
Download latest plugins from Here

Drake

Same Error after replacing all the plugins and the server .. :(




Fjose

surely you are missing something...

anyway about your question, these are my modules used: Windows (x86) Plugins Pack
+ server: Windows Server (x86)

Drake

#26
Quote from: Fjose on Oct 28, 2014, 03:45 PMsurely you are missing something...

anyway about your question, these are my modules used: Windows (x86) Plugins Pack
+ server: Windows Server (x86)

Getting the Same Fucking Error ..
ahhhh   

Sebastian

Well, I know it is a very weird idea... but maybe there is something wrong with the VPS's PC time.
If I am not wrong, time() function returns the time of the pc that runs the server, so maybe something is blocking it. ???

Did you test the script on your server ? If not, give it a try and see the results. ;)

Drake

Quote from: sseebbyy on Oct 28, 2014, 04:26 PMWell, I know it is a very weird idea... but maybe there is something wrong with the VPS's PC time.
If I am not wrong, time() function returns the time of the pc that runs the server, so maybe something is blocking it. ???

Did you test the script on your server ? If not, give it a try and see the results. ;)


I tried both on PC and VPS....... Same error

soulshaker

Quote from: sseebbyy on Oct 28, 2014, 04:26 PMWell, I know it is a very weird idea... but maybe there is something wrong with the VPS's PC time.
If I am not wrong, time() function returns the time of the pc that runs the server, so maybe something is blocking it. ???
same question here, as it works very good for me
<~SouLy^> !exe StaffMessage(time());
<&Busty> 1414520795
<&Busty> This command has been successfully executed.
<~SouLy^> !exe StaffMessage(GetFullTime());
<&Busty> Tuesday, October 28, 2014, 14:27:58 EDT
<&Busty> This command has been successfully executed.