Post: Overflow Fix
11-02-2014, 11:38 PM #1
TheFallen
Former Dark Night
(adsbygoogle = window.adsbygoogle || []).push({}); Overflow Fix
An easy to implement way of preventing any string overflows.

Introduction

Make sure to read the entire thread before attempting to use otherwise there may be issues with it not working properly.

Usage

First get the source from You must login or register to view this content.. You are going to need everything in here so do not try to edit it or remove things as it will most likely cause issues. To use this you must first call initOverflowFix() once in onPlayerSpawned(). You must only call this once for each player otherwise there will be problems.
    
onPlayerSpawned()
{
self endon("disconnect");
level endon( "game_ended" );

// YOU MUST HAVE THIS
isFirstSpawn = true;


for(;Winky Winky
{
self waittill("spawned_player");

// YOU MUST HAVE THIS
// only runs once when the player spawns for the first time
if(isFirstSpawn)
{
initOverFlowFix();

isFirstSpawn = false;
}
}
}


Creating Text

When creating text make sure to use my createText function or if you would rather use your own you must have these three lines at the bottom just before the return statement:
    
// textElem is the name of the object you defined with createFontString()
// view my createText function for an example
textElem.type = "text";
addTextTableEntry(textElem, getStringId(text));
textElem setSafeText(self, text);

You must do this for every text element you use otherwise it will result in an overflow.

Setting Text

When setting text make sure to call setSafeText(<player>, <text>Winky Winky instead of setText(<text>Winky Winky. If you do not do this it will result in an overflow. To use setSafeText() you must call it like so:
    
// textElement is the text element you wish to set text for. This is the object you would normally call setText() on.
// self is the player object you wish to set text for. If you don't know what this is just use self.
textElement setSafeText(self, "text");


Destroying Text

When destroying text you must call clear(<player>Winky Winky instead of destroy(). Clear takes one argument and that is the player that the text element belongs to. If you don't know what I mean by that just use self.
    
textElement clear(self);


Simple Example by Exelo
You can view an example of how to use this You must login or register to view this content..

Real Menu Examples
(adsbygoogle = window.adsbygoogle || []).push({});

The following 33 users say thank you to TheFallen for this useful post:

AlexNGU, Bigmoneyhustlin, BossamBemass, canadiancaper, Chris, codybenti, Devilemi, FatalityMods, Full-Evil, HiddenHour, Im Not Boobdidas, Krypton, Dzre-, LegitGamer264, Magnate13Snake, ModernTriicks, Nothingbutbread, Obris, Patrick, RTE, SaberNGU, ScaRzModZ, Script Kiddie, Shark, Dacoco, SnaY, Taylor, SyGnUs, ViRuzModzHD, xePixTvx, xJessex, xKasper, Zambie
04-24-2016, 03:52 AM #38
xKasper
I am error
Originally posted by TheFallen View Post
Overflow Fix
An easy to implement way of preventing any string overflows.

Introduction

Make sure to read the entire thread before attempting to use otherwise there may be issues with it not working properly.

Usage

First get the source from You must login or register to view this content.. You are going to need everything in here so do not try to edit it or remove things as it will most likely cause issues. To use this you must first call initOverflowFix() once in onPlayerSpawned(). You must only call this once for each player otherwise there will be problems.
    
onPlayerSpawned()
{
self endon("disconnect");
level endon( "game_ended" );

// YOU MUST HAVE THIS
isFirstSpawn = true;


for(;Winky Winky
{
self waittill("spawned_player");

// YOU MUST HAVE THIS
// only runs once when the player spawns for the first time
if(isFirstSpawn)
{
initOverFlowFix();

isFirstSpawn = false;
}
}
}


Creating Text

When creating text make sure to use my createText function or if you would rather use your own you must have these three lines at the bottom just before the return statement:
    
// textElem is the name of the object you defined with createFontString()
// view my createText function for an example
textElem.type = "text";
addTextTableEntry(textElem, getStringId(text));
textElem setSafeText(self, text);

You must do this for every text element you use otherwise it will result in an overflow.

Setting Text

When setting text make sure to call setSafeText(<player>, <text>Winky Winky instead of setText(<text>Winky Winky. If you do not do this it will result in an overflow. To use setSafeText() you must call it like so:
    
// textElement is the text element you wish to set text for. This is the object you would normally call setText() on.
// self is the player object you wish to set text for. If you don't know what this is just use self.
textElement setSafeText(self, "text");


Destroying Text

When destroying text you must call clear(<player>Winky Winky instead of destroy(). Clear takes one argument and that is the player that the text element belongs to. If you don't know what I mean by that just use self.
    
textElement clear(self);


Simple Example by Exelo
You can view an example of how to use this You must login or register to view this content..

Real Menu Examples


Thanks man help alot! Smile
04-28-2016, 04:52 PM #39
I need an fix for to much items in the game

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo