AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   String somehow decides to change itself (https://forums.alliedmods.net/showthread.php?t=240055)

Backstabnoob 05-08-2014 07:06

String somehow decides to change itself
 
Does this make sense to anyone of you?

PHP Code:

client_print0print_chat"Getting the zone..." )
    
new 
szCurrentZone32 ]
if( 
ARP_GetUserZoneidszCurrentZonecharsmaxszCurrentZone ) ) )
{
    
client_print0print_chat"CurrentZone: %s"szCurrentZone )
    
// outputs: CurrentZone: Wagnaria
        
    
new aDataFileStruct ]
        
    
ArrayGetArrayg_aAllSoundsiArrayIdaData )
        
    
client_print0print_chat"Setting trie string to %s. Zone: %s"aData__szFileName ], szCurrentZone )
    
// outputs: Setting trie string to wagnaria.mp3. Zone: agnaria.mp3
        
    
TrieSetStringg_tZonesszCurrentZoneaData__szFileName ] )
        
    new 
szMusic32 ]
    
TrieGetStringg_tZonesszCurrentZoneszMusiccharsmaxszMusic ) )
        
    
client_print0print_chat"The Trie string of %s is now %s."szCurrentZoneszMusic )
    
// outputs: The Trie string of agnaria.mp3 is now wagnaria.mp3.


As you can see, the first client_print outputs the correct string, but the second one is where things start getting strange. Without ABSOLUTELY ANY change to the szCurrentZone string, for some reason after the ArrayGetArray native call it changes itself to agnaria.mp3, which is aData[ __szFileName ] without the first letter.

What is going on? This is getting me a headache... And why is it always me with these weird ass problems?

Backstabnoob 05-08-2014 07:11

Re: String somehow decides to change itself
 
This gotta be a record. Solving it 4 minutes after posting, I feel ashamed.

It seems that doing this at 3 AM in the morning really has its disadventages, I used a wrong structure for the aData variable.

Still makes me wonder how can this even happen, shouldn't I get some sort of access violation error? o.O


All times are GMT -4. The time now is 09:35.

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