Raised This Month: $32 Target: $400
 8% 

[Question] How do I run a virtual function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
djcdude
Junior Member
Join Date: Apr 2007
Old 04-06-2007 , 15:28   [Question] How do I run a virtual function?
Reply With Quote #1

What the title says, I am just wondering how one would run a virtual function (Spawn() in CBaseEntity, to respawn a player, that is what it does right?).
djcdude is offline
BAILOPAN
Join Date: Jan 2004
Old 04-06-2007 , 17:49   Re: [Question] How do I run a virtual function?
Reply With Quote #2

This sounds like a C++ question -- is it?
__________________
egg
BAILOPAN is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 04-06-2007 , 17:59   Re: [Question] How do I run a virtual function?
Reply With Quote #3

If so, I don't think CBaseEntity::Spawn will do what you want. You need CCSPlayer::RoundRespawn which is not virtual and requires a sig scan.
L. Duke is offline
djcdude
Junior Member
Join Date: Apr 2007
Old 04-06-2007 , 21:15   Re: [Question] How do I run a virtual function?
Reply With Quote #4

I was actually hoping of a way to run a virtual function straight from a SourcePawn script.

I think this should be able to be achieved with a native? Unfortuneatly, I don't understand sig scanning or C++ for that matter.
djcdude is offline
BAILOPAN
Join Date: Jan 2004
Old 04-07-2007 , 01:29   Re: [Question] How do I run a virtual function?
Reply With Quote #5

SourceMod doesn't have any way to magically call vtable functions without knowing anything about them (yet) ;) although a generic API to do that might be really interesting... hmm...

Anyway, for now you'll have to settle in C++. After we get SQL and menus out of the way, the next big thing to start will be a module that lets you call CBaseEntity functions.
__________________
egg
BAILOPAN is offline
djcdude
Junior Member
Join Date: Apr 2007
Old 04-07-2007 , 03:21   Re: [Question] How do I run a virtual function?
Reply With Quote #6

Ok thanks.

One more question, will this module allow scripters to hook these functions, or just call them?
djcdude is offline
BAILOPAN
Join Date: Jan 2004
Old 04-07-2007 , 08:32   Re: [Question] How do I run a virtual function?
Reply With Quote #7

What functions are you thinking of hooking?
__________________
egg
BAILOPAN is offline
djcdude
Junior Member
Join Date: Apr 2007
Old 04-07-2007 , 17:03   Re: [Question] How do I run a virtual function?
Reply With Quote #8

Was thinking of hooking Touch(), because I want to create a Deathmatch mod for surfing, so that people have to surf and then find a gun. Once they would walk over a gun, the function connected to the Touch() hook would be called and in it there would be a piece of code to give the person the same type of gun, leaving the Touched one on the ground so next time somebody steps on it they would get that kind of gun. Basically, it would be deathmatch without being able to choose your guns at the start and the guns on the map don't disappear.

Edit: I have decided though to learn C++ and how to do sig scanning to write this for SourceMM

Last edited by djcdude; 04-07-2007 at 17:04. Reason: Forgot something
djcdude is offline
BAILOPAN
Join Date: Jan 2004
Old 04-07-2007 , 18:02   Re: [Question] How do I run a virtual function?
Reply With Quote #9

Sounds good ;) Feel free to post other C++ questions in the SourceMM forum or to ask on IRC (#sourcemod on irc.gamesurge.net)
__________________
egg
BAILOPAN is offline
API
Veteran Member
Join Date: May 2006
Old 04-13-2007 , 00:53   Re: [Question] How do I run a virtual function?
Reply With Quote #10

Quote:
Originally Posted by djcdude View Post
What the title says, I am just wondering how one would run a virtual function (Spawn() in CBaseEntity, to respawn a player, that is what it does right?).
I released an extension that lets you do this, go look at the SigScanner extension.
API is offline
Send a message via AIM to API
Reply


Thread Tools
Display Modes

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 06:53.


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