'%i' and 'random(5)+1' sometimes creates a blank string
#1

So with this code, sometimes it shows a blank space instead of the number. Most of the time it works but sometimes it just doesn't show anything.

PHP код:
new am random(5)+1;
        new 
str[128];
        
format(strsizeof(str), "~w~Collected ~b~%i~w~ lumber."am);
        
GameTextForPlayer(playeridstr30004); 
Reply
#2

This is the code I used and it worked perfectly for me(made a randomnum CMD and spammed it 10000 times, no problem):

new am = random(5)+1;
new str[128];
format(str, sizeof(str), "~w~Collected~b~ %d ~w~lumber.", am);
GameTextForPlayer(playerid, str, 3000, 4);
Reply
#3

Just add a space after embedding your gametext ("~b~"). This is an issue found on GameText functions.
Reply
#4

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
This is the code I used and it worked perfectly for me(made a randomnum CMD and spammed it 10000 times, no problem):

new am = random(5)+1;
new str[128];
format(str, sizeof(str), "~w~Collected~b~ %d ~w~lumber.", am);
GameTextForPlayer(playerid, str, 3000, 4);
It works like 90% of the time for me too, but sometimes this happens... : http://imgur.com/2YO8pwe

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Just add a space after embedding your gametext ("~b~"). This is an issue found on GameText functions.
Thanks, repped you both, didn't see the space at first.
Reply
#5

That's actually what I done, apart from changing %i to %d , have you add spaces between, exactly as mine looks?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)