Raised This Month: $51 Target: $400
 12% 

[DOTA2] Custom Functions Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
beh_g
Junior Member
Join Date: Feb 2014
Location: vietnam
Old 05-05-2014 , 11:34   [DOTA2] Custom Functions Help
Reply With Quote #1

hi
i need a plugin that makes a spectator (who joined spectators team) broadcaster
so i searched a lot but no luck
i found these functions in valve developers website:
Quote:
uint GetBroadcasterChannel( int playerId)
uint GetBroadcasterChannelSlot( int playerId)
so how can i add this functions to sourcemod and use in a plugin?

Last edited by beh_g; 05-05-2014 at 11:34.
beh_g is offline
beh_g
Junior Member
Join Date: Feb 2014
Location: vietnam
Old 05-05-2014 , 20:28   Re: [DOTA2] Custom Functions Help
Reply With Quote #2

so im gonna make a plugin for admin command
but can't make this part work:

Quote:
new ent = GetEntPropEnt(client, Prop_Send, "m_iPlayerID");
SetEntProp(ent, Prop_Send, "m_iBroadcasterChannelSlot", 1);
beh_g is offline
beh_g
Junior Member
Join Date: Feb 2014
Location: vietnam
Old 05-06-2014 , 07:35   Re: [DOTA2] Custom Functions Help
Reply With Quote #3

error: "m_iPlayerID not found"
how can i get playerID ?

Last edited by beh_g; 05-06-2014 at 07:35.
beh_g is offline
beh_g
Junior Member
Join Date: Feb 2014
Location: vietnam
Old 05-06-2014 , 20:05   Re: [DOTA2] Custom Functions Help
Reply With Quote #4

so far i tried:
m_iBroadcasterChannel
m_iBroadcasterChannelSlot
using 'SetEntProp"

plugin works correctly and i can change BroadcasterChannel and BroadcasterChannelSlot of the client
but still nothing changes and client have no casting access
i dont know what is wrong
there is something i couldn't test yet:
AddBroadcastTeamTarget(int Team)
its part of CSceneEntity. i can't find this file
need some help!

Last edited by beh_g; 05-06-2014 at 20:31.
beh_g is offline
CyberStars
Senior Member
Join Date: May 2013
Old 05-07-2014 , 02:43   Re: [DOTA2] Custom Functions Help
Reply With Quote #5

Quote:
Originally Posted by beh_g View Post
so im gonna make a plugin for admin command
but can't make this part work:
Quote:
new ent = GetEntPropEnt(client, Prop_Send, "m_iPlayerID");
SetEntProp(ent, Prop_Send, "m_iBroadcasterChannelSlot", 1);
Should be:
Code:
new pR = GetPlayerResourceEntity();
new id = GetEntProp(client, Prop_Send, "m_iPlayerID");
if(-1 < id) { //It is -1 unless the player is in team (bad, good, spec).
       SetEntProp(pR, Prop_Send, "m_iBroadcasterChannelSlot", 1, _, id);
}
Not tested but you can try also set:
Code:
new pR = GetPlayerResourceEntity();
new id = GetEntProp(client, Prop_Send, "m_iPlayerID");
if(-1 < id) { //It is -1 unless the player is in team (bad, good, spec).
      SetEntProp(pR, Prop_Send, "m_bIsBroadcaster", 1, _, id);
      SetEntProp(pR, Prop_Send, "m_iBroadcasterChannelSlot", 1, _, id);
}
Quote:
Originally Posted by beh_g View Post
Quote:
uint GetBroadcasterChannel( int playerId)
uint GetBroadcasterChannelSlot( int playerId)
so how can i add this functions to sourcemod and use in a plugin?
Try:
Code:
new pR = GetPlayerResourceEntity();
new id = GetEntProp(client, Prop_Send, "m_iPlayerID");
if(-1 < id) { //It is -1 unless the player is in team (bad, good, spec).
       new brCh = GetEntProp(pR, Prop_Send, "m_iBroadcasterChannel", _, id);
       new brChSl = GetEntProp(pR, Prop_Send, "m_iBroadcasterChannelSlot", _, id);
}
CyberStars is offline
beh_g
Junior Member
Join Date: Feb 2014
Location: vietnam
Old 05-07-2014 , 15:35   Re: [DOTA2] Custom Functions Help
Reply With Quote #6

thank you for your help
this is the function:

PHP Code:
public Action:broadcaster(clientargs)
{
    new 
String:arg1[32], String:arg2[32];
    new 
Number StringToInt(arg2);

    new 
pR GetPlayerResourceEntity();
    new 
id GetEntProp(clientProp_Send"m_iPlayerID");
    if(-
id) { //It is -1 unless the player is in team (bad, good, spec).
      
SetEntProp(pRProp_Send"m_bIsBroadcaster"Number_id);
      
SetEntProp(pRProp_Send"m_iBroadcasterChannelSlot"Number_id);
    }
    return 
Plugin_Handled;

i get this error:
Native "GetEntProp" reported: "m_iPlayerID" not found...
any other ideas ?

Last edited by beh_g; 05-07-2014 at 16:04.
beh_g is offline
CyberStars
Senior Member
Join Date: May 2013
Old 05-08-2014 , 02:21   Re: [DOTA2] Custom Functions Help
Reply With Quote #7

Quote:
Originally Posted by beh_g View Post
thank you for your help
this is the function:

PHP Code:
public Action:broadcaster(clientargs)
{
    new 
String:arg1[32], String:arg2[32];
    new 
Number StringToInt(arg2);

    new 
pR GetPlayerResourceEntity();
    new 
id GetEntProp(clientProp_Send"m_iPlayerID");
    if(-
id) { //It is -1 unless the player is in team (bad, good, spec).
      
SetEntProp(pRProp_Send"m_bIsBroadcaster"Number_id);
      
SetEntProp(pRProp_Send"m_iBroadcasterChannelSlot"Number_id);
    }
    return 
Plugin_Handled;

i get this error:
Native "GetEntProp" reported: "m_iPlayerID" not found...
any other ideas ?
Check client connection before getting m_iPlayerID:
Code:
public Action:broadcaster(client, args)
{
    new String:arg1[32], String:arg2[32];
    new Number = StringToInt(arg2);

    new pR = GetPlayerResourceEntity();
    if(IsClientInGame(client) && IsClientConnected(client)) {
           new id = GetEntProp(client, Prop_Send, "m_iPlayerID");
           if(-1 < id) { //It is -1 unless the player is in team (bad, good, spec).
                  SetEntProp(pR, Prop_Send, "m_bIsBroadcaster", Number, _, id);
                  SetEntProp(pR, Prop_Send, "m_iBroadcasterChannelSlot", Number, _, id);
           }
     }
    return Plugin_Handled;
}
CyberStars 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 02:35.


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