Raised This Month: $ Target: $400
 0% 

Run server command on client based on class. SOLVED


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vox Dei
Junior Member
Join Date: Sep 2011
Location: Chattanooga, TN
Old 09-23-2011 , 17:01   Run server command on client based on class. SOLVED
Reply With Quote #1

Greetings,

Does anyone know a good way to have the server recognize the class and run a server or more particularly a sourcemod command(admin level) on them?


========================

Flamin'Sarge helped me solve this.

Code:
#include <sourcemod>
#include <tf2>
#include <tf2_stocks>
#include <tf2items_giveweapon>
public OnPluginStart()
{
     HookEvent("post_inventory_application", HookPlayerSpawn);
}
public Action:HookPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
     new client = GetClientOfUserId(GetEventInt(event, "userid"));
     if (client <= 0 || client > MaxClients || !IsClientInGame(client)) return Plugin_Continue;         
     if (!IsPlayerAlive(client)) return Plugin_Continue;        
     if (TF2_GetPlayerClass(client) == TFClass_Medic)
        TF2Items_GiveWeapon(client, 13);
}
Naturally you could disinclude the tf2_giveitems and put a Servercommand line instead of "tf2items_giveweapon"...

It was really helpful to me.

Last edited by Vox Dei; 09-25-2011 at 16:34. Reason: Solved
Vox Dei is offline
Paparazziv2
Senior Member
Join Date: Feb 2011
Location: Chile, La Serena
Old 09-23-2011 , 17:03   Re: Run server command on client based on class.
Reply With Quote #2

mmm this help you ?
http://forums.alliedmods.net/showthread.php?p=513074
is same
__________________
Sorry for the bad english please.

Paparazziv2 is offline
Send a message via MSN to Paparazziv2
Vox Dei
Junior Member
Join Date: Sep 2011
Location: Chattanooga, TN
Old 09-23-2011 , 17:29   Re: Run server command on client based on class.
Reply With Quote #3

well i need it to run a command automatically after getting their class, so the sm_command depends on their class..

plus, sm_command has to be admin level

preferabbly get class on spawn, if its a certain class, then runs an admin level sourcemod command run on them.

Last edited by Vox Dei; 09-23-2011 at 17:33.
Vox Dei 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 08:53.


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