Raised This Month: $ Target: $400
 0% 

Warnings when compiled


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 04-14-2011 , 08:00   Warnings when compiled
Reply With Quote #1

Hi

Can anyone tell me why I get 'tag mismatch' and 'should return a value' warnings with this:

PHP Code:
VotemapMessage(client)
{
    if (
GetConVarInt(fsVotes) == 1) {
    
decl String:GameType[50];
    
GetGameFolderName(GameTypesizeof(GameType));
    if (
StrEqual(GameType"left4dead") || StrEqual (GameType"left4dead2"false)) {
    return 
Plugin_Continue;
    } else {
        
CPrintToChat(client"%t %t""prefix""votemap message");
    }
    }

This does what it is supposed to, but I would like to understand why it gives warnings

Thanks
Nomarky is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 04-14-2011 , 08:06   Re: Warnings when compiled
Reply With Quote #2

Code:
return Plugin_Continue;

Change that to "return;" and the warnings should go away.

It was basically saying you are returning something from a function that doesn't have a return type.

__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 04-14-2011 , 08:09   Re: Warnings when compiled
Reply With Quote #3

Thanks, that cleared the warnings up. How do I tell when to use 'return;' or 'return Plugin_Continue;' (just for future reference)?
Nomarky is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 04-14-2011 , 12:03   Re: Warnings when compiled
Reply With Quote #4

if there's an Action: tag in your function declaration, e.g.:
public Action:Command_What(client, args)
then you should be returning a Plugin_Continue, Plugin_Stop, Plugin_Handled, etc.,

If there's no Action: tag then you need to return whatever tag is present. For no return value, some people use
void:

If no tag is present then iirc it defaults to a cell.
__________________
databomb is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 04-14-2011 , 13:18   Re: Warnings when compiled
Reply With Quote #5

If the compiler complains you use the other one
AtomicStryker is offline
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 04-14-2011 , 13:24   Re: Warnings when compiled
Reply With Quote #6

Quote:
Originally Posted by databomb View Post
if there's an Action: tag in your function declaration, e.g.:
public Action:Command_What(client, args)
then you should be returning a Plugin_Continue, Plugin_Stop, Plugin_Handled, etc.,

If there's no Action: tag then you need to return whatever tag is present. For no return value, some people use
void:

If no tag is present then iirc it defaults to a cell.
Thanks, that makes sense

Quote:
Originally Posted by AtomicStryker View Post
If the compiler complains you use the other one
I like it
Nomarky 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 13:47.


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