Raised This Month: $ Target: $400
 0% 

Different size usage in nextmap.sma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-01-2009 , 13:57   Different size usage in nextmap.sma
Reply With Quote #1

Here's the code from plugin_init() inside the nextmap.sma:
Quote:
new szString[32], szString2[32], szString3[8]

get_localinfo("lastmapcycle", szString, 31)
parse(szString, szString2, 31, szString3, 7)
g_pos = str_to_num(szString3)
get_cvar_string("mapcyclefile", g_mapCycle, 31)

if (!equal(g_mapCycle, szString2))
g_pos = 0 // mapcyclefile has been changed - go from first

readMapCycle(g_mapCycle, g_nextMap, 31)
set_cvar_string("amx_nextmap", g_nextMap)
format(szString3, 31, "%s %d", g_mapCycle, g_pos) // save lastmapcycle settings
set_localinfo("lastmapcycle", szString3)
The szString3 variable is defined with 8 cells but in the lower code is formated as 31 characters... and the weird thing is, the plugin compiles and works fine, it doesn't report any kind of errors what-so-ever... WHY ? O.o

I also needed that code for something else and tried to replace the variables exacly, but in my case, the server returns "Runtime error 5: memory usage" or something like that... O.o

Can someone explain this, I'm really confused =)
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2009 , 14:07   Re: Different size usage in nextmap.sma
Reply With Quote #2

Quote:
Originally Posted by Hunter-Digital View Post
The szString3 variable is defined with 8 cells but in the lower code is formated as 31 characters... and the weird thing is, the plugin compiles and works fine, it doesn't report any kind of errors what-so-ever... WHY ? O.o
The compiler doesn't know that argument in the function is the length of the string.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-01-2009 , 14:34   Re: Different size usage in nextmap.sma
Reply With Quote #3

Neither does the server ? I said, no errors, but I rewrote it with different variables and gives an in-game error... but this one does not
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2009 , 14:44   Re: Different size usage in nextmap.sma
Reply With Quote #4

Show the code you used.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-01-2009 , 14:45   Re: Different size usage in nextmap.sma
Reply With Quote #5

That depends, if the string formated doesn't exceed the alocated size won't return any error...
__________________
Still...lovin' . Connor noob! Hello
Alka 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 15:11.


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