AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [sovled] using the same events twice? (https://forums.alliedmods.net/showthread.php?t=12604)

n0obie4life 04-19-2005 10:16

[sovled] using the same events twice?
 
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(208) : 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.

XunTric 04-19-2005 10:56

You cant make 2 same events...

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

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...

XxAvalanchexX 04-19-2005 16:55

You can't declare the same function twice but you can have multiple register_events and the such all point to the same function.

BioHazardousWaste 04-19-2005 18:06

lol, nice variable.. i prefer the chopping bit, but you should probably declare a parameter instead of having it defined locally :o

n0obie4life 04-20-2005 03:26

Quote:

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

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

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 :D.

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 :).

BigWalnutZ 04-20-2005 10:11

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.

n0obie4life 04-21-2005 03:12

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.

:D. who told my teacher to be so dumb, almost half the class was surfing other websites :P:P.

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 :D. but if there is no other way..i'll use it.

v3x 04-21-2005 14:01

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 :D. 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]

XxAvalanchexX 04-21-2005 15:22

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".

n0obie4life 04-23-2005 00:48

another question.

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

BTW v3x, that didn't work.


All times are GMT -4. The time now is 10:02.

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