Raised This Month: $ Target: $400
 0% 

Sourcemod for Dota 2?


Post New Thread Closed Thread   
 
Thread Tools Display Modes
OXIZ
Junior Member
Join Date: Feb 2012
Old 03-31-2013 , 09:56   Re: Sourcemod for Dota 2?
#241

Hello! i have few questions

1) event player_spawn is not work ?
2) when i use GetEntProp(client, Prop_Send, "m_iCurrentXP"); public function break :/

how can I fix it? Thank!
OXIZ is offline
OXIZ
Junior Member
Join Date: Feb 2012
Old 03-31-2013 , 09:58   Re: Sourcemod for Dota 2?
#242

Quote:
Originally Posted by Xliado View Post
Well.., could you please explain me where do I have to write this code??, in console? or where...?
also maybe you can put an example please...
add #game_mode_9 in your server.cfg
OXIZ is offline
Tetl
Member
Join Date: Nov 2009
Old 03-31-2013 , 11:10   Re: Sourcemod for Dota 2?
#243

Quote:
Originally Posted by OXIZ View Post
Hello! i have few questions

1) event player_spawn is not work ?
2) when i use GetEntProp(client, Prop_Send, "m_iCurrentXP"); public function break :/

how can I fix it? Thank!
Clients do not have XP. Heroes have XP. The "client" is *you*, the guy in the sky looking at the heroes. Clients have heroes.

Code:
new hero = GetEntPropEnt(client, Prop_Send, "m_hAssignedHero");
SetEntProp(hero, Prop_Send, "m_iCurrentXP", myExp);
On setting EXP: You need to set it directly at an experience threshold or you will have problems:
http://www.playdota.com/mechanics/experience
Tetl is offline
OXIZ
Junior Member
Join Date: Feb 2012
Old 03-31-2013 , 11:31   Re: Sourcemod for Dota 2?
#244

Quote:
Originally Posted by Tetl View Post
Clients do not have XP. Heroes have XP. The "client" is *you*, the guy in the sky looking at the heroes. Clients have heroes.

Code:
new hero = GetEntPropEnt(client, Prop_Send, "m_hAssignedHero");
SetEntProp(hero, Prop_Send, "m_iCurrentXP", myExp);
On setting EXP: You need to set it directly at an experience threshold or you will have problems:
http://www.playdota.com/mechanics/experience
thx!

Code:
#include <sourcemod>

public OnPluginStart() 
{ 
	HookEvent("player_spawn", Event_OnPlayerSpawn);
} 

public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:silent)
{
	PrintToChatAll("Spawn player => %N", GetClientOfUserId(GetEventInt(event, "userid")));
}
not work (

Last edited by OXIZ; 03-31-2013 at 11:32.
OXIZ is offline
Tetl
Member
Join Date: Nov 2009
Old 03-31-2013 , 11:43   Re: Sourcemod for Dota 2?
#245

player_spawn is an older Source event that you probably don't want, you can take a look at Dota's events with GCFSCape:
pak01_dir.vpk\resource\modevents.res
Tetl is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-31-2013 , 11:44   Re: Sourcemod for Dota 2?
#246

Scripting questions should probably go in the Scripting forum. This thread is already getting pretty large.
psychonic is offline
OXIZ
Junior Member
Join Date: Feb 2012
Old 03-31-2013 , 11:56   Re: Sourcemod for Dota 2?
#247

Quote:
Originally Posted by Tetl View Post
player_spawn is an older Source event that you probably don't want, you can take a look at Dota's events with GCFSCape:
pak01_dir.vpk\resource\modevents.res
very thx!!!
OXIZ is offline
Xliado
New Member
Join Date: Mar 2013
Old 03-31-2013 , 14:21   Re: Sourcemod for Dota 2?
#248

Quote:
Originally Posted by OXIZ View Post
add #game_mode_9 in your server.cfg
could you please put here your serve.cfg to play cm mode...
Xliado is offline
M72TheLaw
Junior Member
Join Date: Mar 2013
Old 04-01-2013 , 10:20   Re: Sourcemod for Dota 2?
#249

I'm pretty sure that events aren't being hooked at all, the HookEvent and HookEventEx functions are returning true but my event functions never get called.

I've tried the classic source events as well as (literally) most of the dota specific ones and none fire for me, I can't see them not using any of them at the moment unless they are building for future compatibility I guess.

Just would seem strange to me to have a few dozen events fully listed and not a single one being fired.

Last edited by M72TheLaw; 04-01-2013 at 10:52.
M72TheLaw is offline
Tetl
Member
Join Date: Nov 2009
Old 04-01-2013 , 12:45   Re: Sourcemod for Dota 2?
#250

Quote:
Originally Posted by M72TheLaw View Post
I'm pretty sure that events aren't being hooked at all, the HookEvent and HookEventEx functions are returning true but my event functions never get called.

I've tried the classic source events as well as (literally) most of the dota specific ones and none fire for me, I can't see them not using any of them at the moment unless they are building for future compatibility I guess.

Just would seem strange to me to have a few dozen events fully listed and not a single one being fired.
Code:
public OnPluginStart()
{
	HookEvent("dota_courier_lost", Courier);
	HookEvent("dota_player_used_ability", Ability);
}

public Action:Courier(Handle:event, const String:name[], bool:dontBroadcast)
{
	PrintToServer("bam!");
}

public Action:Ability(Handle:event, const String:name[], bool:dontBroadcast)
{
	PrintToServer("slam!");
}
This works and I've had many other events working correctly in the past
Tetl is offline
Closed Thread



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 15:29.


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