Raised This Month: $32 Target: $400
 8% 

[HELP] Strings in Pawn. Something going wrong?!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
disawar1
AlliedModders Donor
Join Date: Aug 2011
Location: Russian
Old 12-09-2014 , 08:44   [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #1

Code works fine few time ago but now I got a rubbish. I just can't imagine what is wrong here. I suspect that problem is encoding. Anyway my attempts to convert to another encoding not given result. I want to understand how to fix it, anyone can give an explanation?

PHP Code:
#include <sourcemod>

static const String:g_sMannequinModel[][][] =
{
    { 
"hello""world" }, // WHEN I COMMENT THIS LINE CODE WORKS FINE WTF?
    
"models/survivors/survivor_namvet.mdl""bill" },
    { 
"models/survivors/survivor_teenangst.mdl""zoey" },
    { 
"models/survivors/survivor_biker.mdl""francis" }
};


public 
OnPluginStart()
{
    new 
size sizeof(g_sMannequinModel);

    for (new 
isize i++)
        
PrintToChatAll("[%s %s]"g_sMannequinModel[i][0], g_sMannequinModel[i][1]);

Code:
OUTPUT:

[hello world]
[models/survivors/survivor_namvet.mdl urvivors/survivor_namvet.mdl]
[/survivor_namvet.mdl r_namvet.mdl]
[.mdl bill]
Attached Files
File Type: sp Get Plugin or Get Source (mad_world.sp - 234 views - 503 Bytes)
__________________

Last edited by disawar1; 12-09-2014 at 09:02.
disawar1 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-09-2014 , 09:11   Re: [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #2

A few questions:
  • Does this still happen if you specify the dimensions of the array manually, such as static const String:g_sMannequinModel[4][2][64]
  • Did you recently switch the SourceMod version being used to compile the plugin, such as changing from 1.6.2 to 1.7.0?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
disawar1
AlliedModders Donor
Join Date: Aug 2011
Location: Russian
Old 12-09-2014 , 09:28   Re: [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #3

Thanks!
1. I manually set the array size and it solved the problem, such as static const String:g_sMannequinModel[][][56]
2. Nope

I thought that the compiler specify the array size automatically, it not absolutely so, right?
__________________

Last edited by disawar1; 12-09-2014 at 09:28.
disawar1 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-09-2014 , 09:32   Re: [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #4

Quote:
Originally Posted by disawar1 View Post
Thanks!
1. I manually set the array size and it solved the problem, such as static const String:g_sMannequinModel[][][56]
2. Nope

I thought that the compiler specify the array size automatically, it not absolutely so, right?
It's supposed to infer the size when you specify it during creation, but it sounds like it isn't for some reason.

Might be a bug in SourceMod, I'd have to wait for psychonic or asherkin to comment on this to know for sure.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-09-2014 at 09:37.
Powerlord is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-09-2014 , 09:34   Re: [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #5

simple side solution until they reply is to have two variables that has one containing file path, and the other containing the name.
Mitchell is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-09-2014 , 22:42   Re: [HELP] Strings in Pawn. Something going wrong?!
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
It's supposed to infer the size when you specify it during creation, but it sounds like it isn't for some reason.
The problem here is differing sizes at the innermost dimension (which is invalid, for obvious reasons). Manually specifying it removes the ambiguity, and lets the compiler correctly infer the others.
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

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


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