Quote:
Originally Posted by cold-serenity
So when the script uses the hook at the start, anything below that line is tied to that hook? Where can I read more about hooks?
And what does "(Handle:event, const String:name[], bool:dontBroadcast)" all that actually mean?
Also thanks everyone for the help, I am really trying hard to understand sourcepawn. I just started scripting in AutoIt, and now I am moving up to SourcePawn.
And thanks Tyler I will try it now.
Oh tyler, so after this script is ran, will it unload itself? Because my voting system works by loading the script each time.
|
You can read more about sourcepawn here:
http://wiki.alliedmods.net/Category:SourceMod_Scripting
(Look at Events, for this case)
HookEvent is a sourcemod function which requires at least the event name(must be exact, look here:
http://wiki.alliedmods.net/Game_Events_(Source)) and a callback(which can be named whatever you want)
For example:
PHP Code:
HookEvent("player_death", Iamaneventcallbackname_lololol);
The plugin will look for the callback named Iamaneventcallbackname_lololol and execute it, regardless of where it is.
The generic event info is the (Handle:event, const String:name[], bool:dontBroadcast).
The Handle:event is the handle that the event is stored into when hooking, so that information can be taken from it if neccesary(For example, if you wanted to get who died in the player_death event)
The name String is just the name of the event for if you want to use it in chat, or logging, etc
The dontBroadcast boolean just keeps the event message from being sent to clients(It won't prevent the event from being fired). Generally only used when creating an event yourself, not from hooked ones.
In this case:
PHP Code:
HookEvent("player_death", Iamaneventcallbackname_lololol);
Iamaneventcallbackname_lololol(Handle:event, const String:name[], bool:dontBroadcast)
{
//Dostuff
}
I'll check back later if you have more questions. For now, I really need some sleep X_X
Have fun.