AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [Question] How do I run a virtual function? (https://forums.alliedmods.net/showthread.php?t=53570)

djcdude 04-06-2007 15:28

[Question] How do I run a virtual function?
 
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?).

BAILOPAN 04-06-2007 17:49

Re: [Question] How do I run a virtual function?
 
This sounds like a C++ question -- is it?

L. Duke 04-06-2007 17:59

Re: [Question] How do I run a virtual function?
 
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.

djcdude 04-06-2007 21:15

Re: [Question] How do I run a virtual function?
 
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.

BAILOPAN 04-07-2007 01:29

Re: [Question] How do I run a virtual function?
 
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.

djcdude 04-07-2007 03:21

Re: [Question] How do I run a virtual function?
 
Ok thanks.

One more question, will this module allow scripters to hook these functions, or just call them?

BAILOPAN 04-07-2007 08:32

Re: [Question] How do I run a virtual function?
 
What functions are you thinking of hooking?

djcdude 04-07-2007 17:03

Re: [Question] How do I run a virtual function?
 
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

BAILOPAN 04-07-2007 18:02

Re: [Question] How do I run a virtual function?
 
Sounds good ;) Feel free to post other C++ questions in the SourceMM forum or to ask on IRC (#sourcemod on irc.gamesurge.net)

API 04-13-2007 00:53

Re: [Question] How do I run a virtual function?
 
Quote:

Originally Posted by djcdude (Post 461646)
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.


All times are GMT -4. The time now is 20:05.

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