SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/05/2018, 04:34 PM   #21
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 604
Reputation: 18
Default Re: Array out of bounds

Quote:
Originally Posted by Y_Less View Post
No. As I said, your function is way too long - split it up in to small parts and it will become much simpler to debug.
The function doesn't have any problem now, the problem just appeared somewhere else as if it's a cancer..
__________________

forum.nc-rp.cf
JasonRiggs is offline   Reply With Quote
Old 19/05/2018, 05:56 PM   #22
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 604
Reputation: 18
Default Re: Array out of bounds

Anyone? What can cause this?
__________________

forum.nc-rp.cf
JasonRiggs is offline   Reply With Quote
Old 19/05/2018, 07:39 PM   #23
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 604
Reputation: 18
Default Re: Array out of bounds

So, I believe I figured it out, I guess its an enums problem, because I found that other values not just names don't load, Any idea how to fix that?
__________________

forum.nc-rp.cf
JasonRiggs is offline   Reply With Quote
Old 19/05/2018, 11:40 PM   #24
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,010
Reputation: 496
Default Re: Array out of bounds

Rather than bumping this like a madman, show some enum that works, and some that don't.

Also show how you are referring to them in the script as that could be a problem if they aren't referring correctly.
Sew_Sumi is offline   Reply With Quote
Old 19/05/2018, 11:57 PM   #25
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,670
Reputation: 3061
Default Re: Array out of bounds

Probably the same as fixing your function. If a 50 line function is bad, a 50 line enum is so much worse! Split it up.
Y_Less is offline   Reply With Quote
Old 20/05/2018, 12:12 AM   #26
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 604
Reputation: 18
Default Re: Array out of bounds

Quote:
Originally Posted by Y_Less View Post
Probably the same as fixing your function. If a 50 line function is bad, a 50 line enum is so much worse! Split it up.
Actually it's not just 50 lines enums, but 400+

Quote:
Originally Posted by Sew_Sumi View Post
Rather than bumping this like a madman, show some enum that works, and some that don't.

Also show how you are referring to them in the script as that could be a problem if they aren't referring correctly.
Okay, there is the most effective command which I noticed..

the stats command, it's too long, but I'll send you the main part of the command..

and the in game result is in the attachments.

PHP Code:
    SendClientMessageEx(targetid0x7514F6FF"____________________ %s [%s] ____________________"nameGetDate());
    
SendClientMessageEx(targetidCOLOR_WHITE"Level: %i - Gender: %s - Age: %i - Cash: %s - Bank: %s - Hours: %s - Ph: %i"PlayerInfo[playerid][pLevel], genderPlayerInfo[playerid][pAge], FormatNumber(PlayerInfo[playerid][pCash]), FormatNumber(PlayerInfo[playerid][pBank]), FormatNumber(PlayerInfo[playerid][pHours], 0), PlayerInfo[playerid][pPhone]);
    
SendClientMessageEx(targetidCOLOR_NAVYBLUE"Total Wealth: %s - Experience: %s/%s - Next Level: %s - Upgrade Points: %i"FormatNumber(totalwealth), FormatNumber(PlayerInfo[playerid][pEXP], 0), FormatNumber((PlayerInfo[playerid][pLevel] * 4), 0), FormatNumber((PlayerInfo[playerid][pLevel] + 1) * 5000), PlayerInfo[playerid][pUpgradePoints]);
    
SendClientMessageEx(targetidCOLOR_WHITE"Inventory Skill: %i/5 - Addict Skill: %i/3 - Trader Skill: %i/3 - Asset Skill: %i/4 - Labor Skill: %i/5"PlayerInfo[playerid][pInventoryUpgrade], PlayerInfo[playerid][pAddictUpgrade], PlayerInfo[playerid][pTraderUpgrade], PlayerInfo[playerid][pAssetUpgrade], PlayerInfo[playerid][pLaborUpgrade]);
    
SendClientMessageEx(targetidCOLOR_NAVYBLUE"Job: %s - Job 2: %s - Crimes Commited: %s - Times Arrested: %s - Wanted Level: %i"jobsecondjobFormatNumber(PlayerInfo[playerid][pCrimes], 0), FormatNumber(PlayerInfo[playerid][pArrested], 0), PlayerInfo[playerid][pWantedLevel]);
    
SendClientMessageEx(targetidCOLOR_WHITE"Warnings: %i - DM Warnings: %i/3 - Report Warnings: %i/3 - Weapon Restriction: %i hours"PlayerInfo[playerid][pWarnings], PlayerInfo[playerid][pDMWarnings], PlayerInfo[playerid][pReportWarns], PlayerInfo[playerid][pWeaponRestricted]);
    
SendClientMessageEx(targetidCOLOR_NAVYBLUE"Faction: %s - Rank: %s - Division: %s - Gang: %s - Rank: %s - Crew: %s"factionfacrankdivisionganggangrankgangcrew);
    
SendClientMessageEx(targetidCOLOR_WHITE"Paycheck: %s - Insurance: %s - Channel: %i - Cookies: %s - VIP Package: %s"FormatNumber(PlayerInfo[playerid][pPaycheck]), insurancePlayerInfo[playerid][pChannel], FormatNumber(PlayerInfo[playerid][pCookies], 0), GetVIPRank(PlayerInfo[playerid][pVIPPackage]));
    
SendClientMessageEx(targetidCOLOR_NAVYBLUE"Playing Time: %i/60 mins - Jail Type: %s - Jail Time: %s sec - Double XP: %i hours"PlayerInfo[playerid][pMinutes], jailtypeFormatNumber(PlayerInfo[playerid][pJailTime], 0), PlayerInfo[playerid][pDoubleXP]);
    
SendClientMessageEx(targetidCOLOR_WHITE"Married To: %s"PlayerInfo[playerid][pMarriedName]); 
And this is the in game result
Attached Images
File Type: jpg sa-mp-119.jpg (203.4 KB, 5 views)
__________________

forum.nc-rp.cf
JasonRiggs is offline   Reply With Quote
Old 20/05/2018, 05:49 AM   #27
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,010
Reputation: 496
Default Re: Array out of bounds

Why all that FormatNumber?

Making all of this happen at once, will likely cause issue as what Y_Less has been saying. All of those calls are being done on that one line.

But why format all those numbers like that, they should almost be in the correct format already before this.
Sew_Sumi is offline   Reply With Quote
Old 20/05/2018, 07:00 AM   #28
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,670
Reputation: 3061
Default Re: Array out of bounds

Yes, my point was an enum 50 lines long is terrible, so one 400 lines long must be horrific.
Y_Less is offline   Reply With Quote
Old 20/05/2018, 11:20 AM   #29
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 604
Reputation: 18
Default Re: Array out of bounds

Quote:
Originally Posted by Sew_Sumi View Post
Why all that FormatNumber?

Making all of this happen at once, will likely cause issue as what Y_Less has been saying. All of those calls are being done on that one line.

But why format all those numbers like that, they should almost be in the correct format already before this.
Guys the point is that they used to work,and there are servers using this script and it's working..
__________________

forum.nc-rp.cf
JasonRiggs is offline   Reply With Quote
Old 20/05/2018, 07:20 PM   #30
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,010
Reputation: 496
Default Re: Array out of bounds

Quote:
Originally Posted by JasonRiggs View Post
Guys the point is that they used to work,and there are servers using this script and it's working..
Bad coding practices will collapse over time... It may work in its state, but it's bad, and then when it breaks, it's real bad.

What'd you do, or update around the time this started?
Sew_Sumi is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array out of bounds? Not possible faxxe Scripting Help 3 05/03/2017 12:28 PM
Array out of bounds? LegendOfScripts Scripting Help 1 11/03/2015 09:52 PM
Array out of bounds,, please help me! audyantgtr Scripting Help 3 15/03/2014 11:16 PM
Array out of Bounds San1 Scripting Help 8 08/07/2013 08:50 PM
Array out of bounds - wth? Seven_of_Nine Help Archive 2 20/05/2011 04:22 PM


All times are GMT. The time now is 08:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.