Raised This Month: $ Target: $400
 0% 

[sovled] using the same events twice?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 04-19-2005 , 10:16   [sovled] using the same events twice?
Reply With Quote #1

is it possible?

i have register_logevent and register_event and count_votes and all that crap for voting in my script. can i use it twice?

if i can't then how do i make it so that i can use it twice?

cause when i compile my plugin with those commands repeated twice....i have a problem

Quote:
//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// vote_aio.sma
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(20 : error 021: symbol already defined: "event_RoundStart"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(304) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(314) : error 021: symbol already defined: "check_the_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(386) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(396) : error 021: symbol already defined: "check_the_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(409) : error 021: symbol already defined: "event_RoundStart"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(484) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(494) : error 021: symbol already defined: "check_the_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(507) : error 021: symbol already defined: "event_RoundStart"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(583) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(593) : error 021: symbol already defined: "check_the_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(606) : error 021: symbol already defined: "event_RoundStart"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(681) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(691) : error 021: symbol already defined: "check_the_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(704) : error 021: symbol already defined: "event_RoundStart"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(781) : error 021: symbol already defined: "count_votes"
// C:\Documents and Settings\XPHome\Desktop\my it work\My plugins\Compiler\vote_
aio.sma(791) : error 021: symbol already defined: "check_the_votes"
i'm trying to make a vote_aio. i also need the event_roundstart cause i want it to happen only once at the start of round.
n0obie4life is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-19-2005 , 10:56  
Reply With Quote #2

You cant make 2 same events...

But one way is to chop a event in two with a bool

like:
Code:
new bool:smartass public ResetHUD {     if(smartass == false) {          //Do stuff...     }     if(smartass == true) {          //Do stuff....     } }

So now just change between true and false in your script depending on what part of the event you want to use...
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-19-2005 , 16:55  
Reply With Quote #3

You can't declare the same function twice but you can have multiple register_events and the such all point to the same function.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-19-2005 , 18:06  
Reply With Quote #4

lol, nice variable.. i prefer the chopping bit, but you should probably declare a parameter instead of having it defined locally
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 04-20-2005 , 03:26  
Reply With Quote #5

Quote:
Originally Posted by XunTric
You cant make 2 same events...

But one way is to chop a event in two with a bool

like:
Code:
new bool:smartass public ResetHUD {     if(smartass == false) {          //Do stuff...     }     if(smartass == true) {          //Do stuff....     } }

So now just change between true and false in your script depending on what part of the event you want to use...
o.o. i'll try that .

but is it possible not to use count_votes ? even if i want to count it?

cause my

register_menu(question), <some numbers>, count_votes

is like that. sry i cannot give the full sentence. i'm in school now, sneaked upon the PC while i'm in de lab .
n0obie4life is offline
BigWalnutZ
Junior Member
Join Date: Apr 2005
Old 04-20-2005 , 10:11  
Reply With Quote #6

Quote:
Originally Posted by n0obie4life
is like that. sry i cannot give the full sentence. i'm in school now, sneaked upon the PC while i'm in de lab .
LOL but you had time to write this short paragraph.
__________________
I am 77% addicted to Counterstrike. What about you?
BigWalnutZ is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 04-21-2005 , 03:12  
Reply With Quote #7

Quote:
Originally Posted by BigWalnutZ
Quote:
Originally Posted by n0obie4life
is like that. sry i cannot give the full sentence. i'm in school now, sneaked upon the PC while i'm in de lab .
LOL but you had time to write this short paragraph.
. who told my teacher to be so dumb, almost half the class was surfing other websites .

anyway, my register menus are this

Code:
    register_menucmd(register_menuid("\yPara Only?"),(1<<0)|(1<<1),"count_votes")     register_menucmd(register_menuid("\yGrenades Only?"),(1<<0)|(1<<1),"count_votes")

so if i just change the "count_votes" , it will still count the vote right?


btw, i couldn't do what XunTric taught me .

its supposed to do this

Code:
  public event_RoundStart() {     for(new p = 0; p < 32; p++) {         if(is_user_alive(p)) {             give_item(p, "weapon_m249")             give_item(p, "ammo_556natobox")             give_item(p, "ammo_556natobox")             give_item(p, "ammo_556natobox")         }     }     return PLUGIN_HANDLED  }

for every single weapon mode. so i need that.

BTW, i did not use that cs_set_bpammo (something like that) on purpose . but if there is no other way..i'll use it.
n0obie4life is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-21-2005 , 14:01  
Reply With Quote #8

Quote:
Originally Posted by n0obie4life
its supposed to do this
Code:
  public event_RoundStart() {     for(new p = 0; p < 32; p++) {         if(is_user_alive(p)) {             give_item(p, "weapon_m249")             give_item(p, "ammo_556natobox")             give_item(p, "ammo_556natobox")             give_item(p, "ammo_556natobox")         }     }     return PLUGIN_HANDLED  }

for every single weapon mode. so i need that.

BTW, i did not use that cs_set_bpammo (something like that) on purpose . but if there is no other way..i'll use it.
Try this:
Code:
#include <amxmodx> #include <fun> public plugin_init() {     // ..     register_logevent("event_RoundStart",2,"0=World triggered","1=Round_Start") } public event_Round_Start() {     set_task(2.0,"RoundStart",_,_,_,"b")     return PLUGIN_HANDLED } public RoundStart() {     new players[32]     new player[32]     new num     get_players(players,num,"a")     // If specified, you can constrain which players are returned by flags:     // "a" - Don't return dead players     // "b" - Don't return alive players     // "c" - Skip bots     // "d" - Skip real players     // "e" - Match with passed team     // "f" - Match with part of name     // "g" - Ignore case sensitivity     for(new p = 0; p < num; p++) {         player = players[p]         give_item(player, "weapon_m249")         give_item(player, "ammo_556natobox")         give_item(player, "ammo_556natobox")         give_item(player, "ammo_556natobox")     }     return PLUGIN_HANDLED }

You don't need to check if the user is alive or not, it won't return dead players.

[EDITED]
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-21-2005 , 15:22  
Reply With Quote #9

All players may very well be dead on "round start", and might not have even been given their weapons yet. Try delaying your weapon giving for a second or two after "round start".
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 04-23-2005 , 00:48  
Reply With Quote #10

another question.

if i change "count_votes" and "check_the_votes" to something else, will it still work?

BTW v3x, that didn't work.
n0obie4life is offline
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 10:02.


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