Raised This Month: $ Target: $400
 0% 

I have a question [important]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-31-2005 , 22:01   I have a question [important]
Reply With Quote #1

can i create my own events?
i mean there is "ResetHUD" and "DeathMsg" and i want to know if i can create 1 of my own like "IsUsingKnife"

example:
register_event("IsUsingKnife","func_knifepowe r","a")

and please if the answer is yes.. give me an example ..
thanks alot
haimmaik is offline
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 10-31-2005 , 22:11  
Reply With Quote #2

no you can't create your own events but if you want a function to be called whenever someone uses a knife then you probably want to register the "CurWeapon" event then check to see if they switched to a knife using read_data(2) and comparing it to CSW_KNIFE

Example:

Code:
new wpn = read_data(2)
if(wpn == CSW_KNIFE)
     doStuff(id)
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-31-2005 , 22:38  
Reply With Quote #3

and if i have a Variable like
new isgod[33]

and i want an event to give a "god" player his status (speed, gravity and so on) so i need an event

register_event("isgod","func_godstatus","a")
.
.
.

//here i set the god status everytime event isgod is on
public func_godstatus(id)
{
.
.
}


i mean as long as he is a god (isgod[id]=1) i want the function "func_godstatus" to run on him.. and when he isnt a god anymore (isgod[id]=0) i dont want it to run

(all this to prevent the server from lag cuz it lags when a function starts looping all the time)
haimmaik is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-31-2005 , 22:51  
Reply With Quote #4

client_PreThink? Or run it in ResetHUD?
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-31-2005 , 23:07  
Reply With Quote #5

You can't create your own events.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-31-2005 , 23:07  
Reply With Quote #6

whats client_PreThink? how i use it? :\
haimmaik is offline
cybermind
Senior Member
Join Date: Oct 2004
Old 10-31-2005 , 23:47  
Reply With Quote #7

http://www.amxmodx.org/funcwiki.php?...hink&go=search
cybermind is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 07:14  
Reply With Quote #8

You just make a function called "public client_PreThink(id)". You need to have Engine included.

It's called every client frame.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-01-2005 , 07:19  
Reply With Quote #9

Eh, isn't it called more than once every frame?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 07:28  
Reply With Quote #10

No.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 23:42.


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