Raised This Month: $ Target: $400
 0% 

Solved Setting user team with client_cmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CouldYouPlease051
Junior Member
Join Date: Mar 2017
Old 03-21-2017 , 11:00   Setting user team with client_cmd
Reply With Quote #1

PHP Code:
public handleJoin(id) {
  if(
bool:g_PlayerData[id][inTeam] == true) {
    return 
PLUGIN_HANDLED_MAIN;
  }

  return 
PLUGIN_CONTINUE;

Handles jointeam and joinclass commands.
This part in the function is causing me problems:
PHP Code:
g_PlayerData[id][inTeam] = false;
client_cmd(id"jointeam 1");
client_cmd(id"joinclass 5");
//g_PlayerData[id][inTeam] = true; 
If the boolean is commented out, it works perfectly, when it's not .. it won't work. I have an idea that I must have a longer delay when setting inTeam to true again but that would require me to create a task..

Am I doing anything wrong? Is there a better way so I wouldn't have to set a task?

Last edited by CouldYouPlease051; 03-21-2017 at 16:52.
CouldYouPlease051 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-21-2017 , 11:08   Re: Setting user team with client_cmd
Reply With Quote #2

Try engclient_cmd() instead.

Last edited by klippy; 03-21-2017 at 11:08.
klippy is offline
CouldYouPlease051
Junior Member
Join Date: Mar 2017
Old 03-21-2017 , 11:19   Re: Setting user team with client_cmd
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
Try engclient_cmd() instead.
Silly, but that oughta do it, thank you.
CouldYouPlease051 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-21-2017 , 12:16   Re: Setting user team with client_cmd
Reply With Quote #4

Is this in client_putinserver?
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
CouldYouPlease051
Junior Member
Join Date: Mar 2017
Old 03-21-2017 , 14:49   Re: Setting user team with client_cmd
Reply With Quote #5

Quote:
Originally Posted by PRoSToTeM@ View Post
Is this in client_putinserver?
No, this is in a delayed function which is hooked with the ShowMenu and VGUIMenu message.
CouldYouPlease051 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-21-2017 , 15:11   Re: Setting user team with client_cmd
Reply With Quote #6

as KliPPy said

PHP Code:
engclient_cmd(id"jointeam""5")
engclient_cmd(id"joinclass""5"
Edit:

If it works with client_cmd(). Then show the whole code.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-21-2017 at 15:14.
EFFx is offline
CouldYouPlease051
Junior Member
Join Date: Mar 2017
Old 03-21-2017 , 16:49   Re: Setting user team with client_cmd
Reply With Quote #7

Quote:
Originally Posted by EFFx View Post
as KliPPy said

PHP Code:
engclient_cmd(id"jointeam""5")
engclient_cmd(id"joinclass""5"
Edit:

If it works with client_cmd(). Then show the whole code.
Right.. I'd like to believe I was quite clear about KliPPy's solution working just fine, it seems you either misunderstood or you're simply postcounting.
CouldYouPlease051 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-21-2017 , 16:55   Re: Setting user team with client_cmd
Reply With Quote #8

Oh sry, I didn't know what was 'oughta', sry.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx 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 17:59.


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