Raised This Month: $51 Target: $400
 12% 

Undefined Symbol


Post New Thread Reply   
 
Thread Tools Display Modes
Visual77
Veteran Member
Join Date: Jan 2009
Old 01-21-2014 , 08:26   Re: Undefined Symbol
Reply With Quote #21

Quote:
Originally Posted by friagram View Post
Createdatatimer automatically closes the handle when it expires, the flag is not necessary for datatimers.
You only need to close it if you manually create a data pack and pass that, be it a timer, or anywhere.
You can do it 3 ways, correct? Supposly you may also need to set hChooseTeamMenuTimer back to INVALID_HANDLE in the timer callbacks and
a if (hChooseTeamMenuTimer != INVALID_HANDLE) check OnMapEnd() were in the case you would have to kill the timer and set the handle back to invalid.

Code:
new Handle:pack;
hChooseTeamMenuTimer = CreateDataTimer(0.5, Timer_ChooseTeamMenu, pack);
WritePackCell(pack, client);

public Action:Timer_ChooseTeamMenu(Handle:timer, Handle:pack)
{
    ResetPack(pack);
    new client = ReadPackCell(pack);
}
OR

Code:
new Handle:pack = CreateDataPack();
WritePackCell(pack, client);
hChooseTeamMenuTimer = CreateTimer(0.5, Timer_ChooseTeamMenu, pack);

public Action:Timer_ChooseTeamMenu(Handle:timer, Handle:pack)
{
    ResetPack(pack);
    new client = ReadPackCell(pack);
    CloseHandle(pack);
}
OR

Code:
new Handle:pack = CreateDataPack();
WritePackCell(pack, client);
hChooseTeamMenuTimer = CreateTimer(0.5, Timer_ChooseTeamMenu, pack, TIMER_DATA_HNDL_CLOSE);

public Action:Timer_ChooseTeamMenu(Handle:timer, Handle:pack)
{
    ResetPack(pack);
    new client = ReadPackCell(pack);
    //CloseHandle(pack);
}

Last edited by Visual77; 01-21-2014 at 08:40.
Visual77 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-21-2014 , 13:24   Re: Undefined Symbol
Reply With Quote #22

Quote:
Originally Posted by QOOOOOOOOQ View Post
Also I've always wondered why add an extra check for IsClientInGame if them being a valid client on the server is already true?
What are you using to guarantee that they're a valid client? Oh right, IsClientInGame...

Quote:
Originally Posted by QOOOOOOOOQ View Post
Also... what's the point of MaxClients instead of MAXPLAYERS... they'd both end up with the same end-result no?
MAXPLAYERS is (currently) hard-coded at the max number of players any Source game supports. Currently this is 65 due to CS:S suppporting 64 players plus SourceTV. You can see this value by looking in scripting/include/clients.inc.

MaxClients is equal to your -maxplayers command-line setting (or gamemodes setting/-maxplayers_override for CS:GO). MaxClients isn't set until the first time a map starts and in unavailable at compile-time, so you can't create global arrays using it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 01-21-2014 at 13:26.
Powerlord is offline
QOOOOOOOOQ
Senior Member
Join Date: Dec 2012
Old 01-21-2014 , 13:49   Re: Undefined Symbol
Reply With Quote #23

Quote:
Originally Posted by Visual77 View Post
Shouldn't TIMER_DATA_HNDL_CLOSE only be used when a datapack is passed to the timer and CreateDataTimer isn't being used? It's to avoid adding CloseHandle to the datapack timer function from my understanding.
MAXPLAYERS is bad form for loops, it's a fixed value of 64 or 65. MaxClients is all the players on the server - could be 8 players if your server has 8 players.

You need IsClientInGame because native GetClientTeam(client) can error out if the client is not in game? What Marcus_Brown001 said btw too. If you wouldn't have GetClientTeam in your loop, you most likely wouldn't need
IsClientInGame. For example, just resetting a boolean on all clients back to false wouldn't be needing IsClientInGame.

http://docs.sourcemod.net/api/index....d=show&id=411&
Ah I got the MaxClients and MAXPLAYERS defines mixed up...

Quote:
Originally Posted by friagram View Post
Createdatatimer automatically closes the handle when it expires, the flag is not necessary for datatimers.
You only need to close it if you manually create a data pack and pass that, be it a timer, or anywhere.
Do handles set to timers close when the timer is done automatically then? Because I have many instances where it uses that to check if a timer is running, so only one instance of the timer can be run at once instead of multiple timers for the exact same thing are running and will make it very buggy.

@Visual77 All instances include datapacks, which is useless for what I'm doing, in fact adding it would just make it unnecessarily complicated for no reason, when a player leaves the game, it tells spectators to enter commands - which has nothing to do with the client that left, the client that left doesn't even matter.

Last edited by QOOOOOOOOQ; 01-21-2014 at 13:55.
QOOOOOOOOQ is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 01-21-2014 , 14:30   Re: Undefined Symbol
Reply With Quote #24

It was an example as to were TIMER_DATA_HNDL_CLOSE could be used. Shouldn't be used unless you work with data packs anyway so
you may have used it incorrectly, but I'm not sure. Wiki dosn't really explain much about this timer flag.

Last edited by Visual77; 01-21-2014 at 14:41.
Visual77 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-21-2014 , 15:03   Re: Undefined Symbol
Reply With Quote #25

Quote:
Originally Posted by Visual77 View Post
It was an example as to were TIMER_DATA_HNDL_CLOSE could be used. Shouldn't be used unless you work with data packs anyway so
you may have used it incorrectly, but I'm not sure. Wiki dosn't really explain much about this timer flag.
Mainly because it's essentially a deprecated flag and you should be using CreateDataTimer instead.

Really, though, all it does is call CloseHandle on whatever Handle you passed as the data arg when the timer ends.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 01-21-2014 at 15:03.
Powerlord is offline
QOOOOOOOOQ
Senior Member
Join Date: Dec 2012
Old 01-26-2014 , 21:03   Re: Undefined Symbol
Reply With Quote #26

Ok I've narrowed down basically most of the errors, and now there's about 20 undefined variable errors. EVERY timer function, which takes up about 70%+ of them, so I'll post some examples here.

Know that the same errors occur whether I have only the first 2 parameters of CreateTimer(), or all 4.
Spoiler

Spoiler

Spoiler

Last edited by QOOOOOOOOQ; 01-26-2014 at 22:49.
QOOOOOOOOQ is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 01-26-2014 , 22:11   Re: Undefined Symbol
Reply With Quote #27

I can't tell what is undefined from looking at those snippets ... Inside the snippets provided, can you bold, underline, or italicize the specific lines that are spitting errors.

Some things I did notice, however:
  • When looping through the players, you should use MaxClients instead of MAXPLAYERS + 1
  • Instead of passing a client's index inside of a timer, you should pass his serial or userid (GetClientSerial or GetClientUserId).
  • When looping through the players on a server, you should always check the client's validity (you should probably do that inside timers as well). This check could be something as simple as IsClientInGame.
Marcus_Brown001 is offline
QOOOOOOOOQ
Senior Member
Join Date: Dec 2012
Old 01-26-2014 , 22:49   Re: Undefined Symbol
Reply With Quote #28

Well I listed the words that were undefined... marked the lines now, since you can't bold PHP, that's as good as I can do. Makes a good point for auth method over time through timers, I might as well do that for everything, would probably make it a lot easier, and will add the checks, do all that stuff at the end when I want to optimize. (Like during events, do everything I can using userid, since it appears to be more reliable)
QOOOOOOOOQ is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-27-2014 , 10:01   Re: Undefined Symbol
Reply With Quote #29

The number one cause of a function you're defining showing up as an undefined symbol is that a block isn't closed somewhere (i.e. you're missing a "}" )
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-27-2014 , 11:55   Re: Undefined Symbol
Reply With Quote #30

i doubt he actually didn't declare the variable properly..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX 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 14:50.


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