Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

TextDraw problem

$
0
0
Hello, world. I have 2 TextDraw that need to be updated on a function call. The problem is that the TextDraw are not updated immediately, but only after a set of variable characters. Sometimes TextDraw disappear and reappear.

PHP Code:

const STR_CHEAT_LIM 99;
new 
CheatO [STR_CHEAT_LIM];
new 
CheatW [STR_CHEAT_LIM];

new 
Text:CheatShow_O,
Text:CheatShow_W;

public 
OnGameModeInit()
{
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    
CheatShow_O TextDrawCreate(9.3423.4"_");
    
TextDrawColor(CheatShow_O0xef8100FF);
    
TextDrawFont(CheatShow_O1);
    
TextDrawSetOutline(CheatShow_O1);
    
TextDrawLetterSize(CheatShow_O0.3161.282);

    
CheatShow_W TextDrawCreate(9.3434.4"_");
    
TextDrawColor(CheatShow_W0xffffffFF);
    
TextDrawFont(CheatShow_W1);
    
TextDrawSetOutline(CheatShow_W1);
    
TextDrawLetterSize(CheatShow_W0.3161.282);
    
SetTimer ("GOSTR"2000true);
    return 
1;
}

forward GOSTR();
public 
GOSTR()
{
    new 
typel random(3);
    new 
st_player random(500);
    
AddCheatStr(st_playertypel);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
TextDrawShowForPlayer (playeridCheatShow_O);
    
TextDrawShowForPlayer (playeridCheatShow_W);
    return 
1;
}

stock AddCheatStr(playeridtype){
    new 
num_id;
    switch (
playerid)
    {
    case 
0..9num_id 1;
    case 
10..99num_id 2;
    case 
100..999num_id 3;
    case 
1000..9999num_id 4;
    }
    static const
    
add_id_g [] = "~g~%d",
    
add_id_b [] = "~b~%d",
    
add_id_w [] = "~w~%d";
    new 
add_diff sizeof add_id_g -num_id;
    new 
num_str;
    if (
type == || type == 2)
    {
        
num_str strlen (CheatO);
    }
    else
    {
        
num_str strlen (CheatW);
    }
    new 
diff add_diff num_str;
    new 
tempcheat [7];
    if (
type == 0)
    {
        
format (tempcheatsizeof (tempcheat), add_id_gplayerid);
        
format (CheatOsizeof (CheatO), "%s\t %s"tempcheatCheatO);
    }
    else if (
type == 2)
    {
        
format (tempcheatsizeof (tempcheat), add_id_bplayerid);
        
format (CheatOsizeof (CheatO), "%s\t %s"tempcheatCheatO);
    }
    else
    {
        
format (tempcheatsizeof (tempcheat), add_id_wplayerid);
        
format (CheatWsizeof (CheatW), "%s\t %s"tempcheatCheatW);
    }
    if (
diff STR_CHEAT_LIM)
    {
        if (
type == || type == 2)
        {
            
num_str strlen (CheatO);
            if (
CheatO[num_str-1] == 'b' || CheatO[num_str-1] == 'g')
            {
                
strdel (CheatOnum_str-1-1STR_CHEAT_LIM);
            }
            if (
CheatO[num_str-1] == '~')
            {
                if (
CheatO[num_str-1-1] == ' ')
                {
                    
strdel (CheatOnum_str-1STR_CHEAT_LIM);
                }
            }
        }
        else
        {
            
num_str strlen (CheatW);
            if (
CheatW[num_str-1] == 'w')
            {
                
strdel (CheatWnum_str-1-1STR_CHEAT_LIM);
            }
            if (
CheatW[num_str-1] == '~')
            {
                if (
CheatW[num_str-1-1] == ' ')
                {
                    
strdel (CheatWnum_str-1STR_CHEAT_LIM);
                }
            }
        }
    }
    
TextDrawSetString(CheatShow_OCheatO);
    
TextDrawSetString(CheatShow_WCheatW);
    return 
true;



Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>