Raised This Month: $ Target: $400
 0% 

Out of Bounds formatex


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-20-2009 , 00:44   Re: Out of Bounds formatex
Reply With Quote #5

Hmm, it still went out. I'm also only putting one letter into WriteTitle in an attempt to make it as small as possible.

PHP Code:
public SQL_NewLetter(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
        return 
set_fail_state("Could not connect to SQL database.")
    else if(
FailState == TQUERY_QUERY_FAILED)
        return 
set_fail_state("Query failed.")
    
    if(
Errcode)
        return 
log_amx("Error on query: %s",Error)
    
    new 
Items[2]
    new 
ItemsNames[1][33]
    new 
ItemsModels[1][65]
    
    
Items[0]=SQL_GetInsertId(Query)
    
Items[1]=1
    
    formatex
(ItemsNames[0],32,"Letter: %s",WriteTitle[Data[0]])
    
ItemsModels[0]="models/Roleplay/Backpack.mdl"
    
    
AddItems(Data[0],1,Items,ItemsNames,ItemsModels)
        
    return 
PLUGIN_CONTINUE

The whole function. WriteTitle is global.

Heh, even made it [1][3300] and it still went out of bounds.

Edit: I think it must be the that WriteTitle is somehow going out of bounds because of the value that's in Data[0], but that should be the player's index...

PHP Code:
if(!WritingLetter[id])
 {
     
client_print(id,print_chat,"*End of letter.")
     new 
Data[1]
    
Data[0]=id
    
    
new Query[256]
    
format(Query,255,"INSERT INTO items (ItemName,ItemDescription,ItemString,ItemCommand) VALUES ('Letter: %s','Letter: %s','%s','Item_Letter')",WriteTitle[id],WriteDescription[id],WriteLocation[id])
    
SQL_ThreadQuery(SQL_Tuple,"SQL_NewLetter",Query)

Final edit: F*** I forgot to pass in the data array ;/

Thanks for your help guys.
__________________

Last edited by Bad_Bud; 08-20-2009 at 00:55.
Bad_Bud is offline
 



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


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