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

Solved Doesn't return a value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lmfao
Junior Member
Join Date: Oct 2011
Old 01-17-2022 , 14:28   Doesn't return a value
Reply With Quote #1

Hi.
I don't understand why Handler_VoteCallback doesn't return a value.
Any idea?
No error in compilation.
I only got this error
Code:
L 01/17/2022 - 20:14:40: [SM] Call stack trace:
L 01/17/2022 - 20:14:40: [SM]   [0] VFormat
L 01/17/2022 - 20:14:40: [SM]   [1] Line 94, C:\Users\User\Docs\dev\addons\sourcemod\scripting\include\multicolors.inc::CPrintToChatAll
L 01/17/2022 - 20:14:40: [SM]   [2] Line 179, testvote.sp::Handler_VoteCallback
L 01/17/2022 - 20:14:40: [SM] Exception reported: Language phrase "{default}Vote Successful" not found (arg 3)
L 01/17/2022 - 20:14:34: [SM] Exception reported: Language phrase "{default}}No Votes Cast" not found (arg 3)
L 01/17/2022 - 20:11:34: [SM] Exception reported: Language phrase "{default}Vote Failed" not found (arg 3)
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <multicolors>

#define PLUGIN_VERSION "1.0"
#define VOTE_NO "###no###"
#define VOTE_YES "###yes###"

ConVar g_CVar_mp_timeround;

public 
Plugin:myinfo =
{
    
name "test",
    
author "test",
    
description "test plugin",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_fmptimeround"Command_ForceTimeroundADMFLAG_CONVARS"Force Forcetimeround Enable 1/0");
    
g_CVar_mp_timeround FindConVar("mp_timeround");
}
public 
int Handler_VoteCallback(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_DisplayItem)
    {
        
char display[64];
        
menu.GetItem(param2""0_displaysizeof(display));

         if (
strcmp(displayVOTE_NO) == || strcmp(displayVOTE_YES) == 0)
         {
            
char buffer[255];
            
Format(buffersizeof(buffer), "%T"displayparam1);

            return 
RedrawMenuItem(buffer);
        }
    }
    else if (
action == MenuAction_VoteCancel && param1 == VoteCancel_NoVotes)
    {
        
CPrintToChatAll("{green}[SM] %t""{default}}No Votes Cast");
    } 

Last edited by Lmfao; 01-18-2022 at 13:41. Reason: Solved
Lmfao is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-17-2022 , 16:02   Re: Doesn't return a value
Reply With Quote #2

You didn't include the "Exception reported" line which tells you what the error is...
__________________
Psyk0tik is offline
Lmfao
Junior Member
Join Date: Oct 2011
Old 01-17-2022 , 16:18   Re: Doesn't return a value
Reply With Quote #3

Quote:
Originally Posted by Psyk0tik View Post
You didn't include the "Exception reported" line which tells you what the error is...
Sorry, i re-checked logs. And here it's what i found. I updated the original post.
Thanks for taking your time to help me
Lmfao is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-17-2022 , 16:49   Re: Doesn't return a value
Reply With Quote #4

Okay, I believe the issue is that you need to add these lines in OnPluginStart().
PHP Code:
LoadTranslations("basevotes.phrases");
LoadTranslations("common.phrases"); 
You also need to fix the phrases. Remember that the chat color tags like "default" are meant for literal phrases (the string containing format specifiers like "%t").
Change these:
PHP Code:
"{green}[SM] %t""{default}}No Votes Cast"
"{green}[SM] %t"
"{default}Vote Failed"
"{green}[SM] %t"
"{default}Vote Successful" 
To these:
PHP Code:
"{green}[SM]{default} %t""No Votes Cast"
"{green}[SM]{default} %t"
"Vote Failed"
"{green}[SM]{default} %t"
"Vote Successful" 
__________________
Psyk0tik is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-17-2022 , 17:09   Re: Doesn't return a value
Reply With Quote #5

You need to change "{default}Vote Successful" to "Vote Successful" and where it has "%t" change to "{default}%t" it's trying to use the color code for translation. Same with all the other lines doing the same sort of thing. Also what Psyk0tik said about "LoadTranslations".
__________________
Silvers is offline
Lmfao
Junior Member
Join Date: Oct 2011
Old 01-18-2022 , 13:41   Re: Doesn't return a value
Reply With Quote #6

Worked like a charm.
Thanks a lot. Realy appreciate.
Lmfao 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 01:04.


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