SA-MP Forums Archive
Easy, but not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Easy, but not working (/showthread.php?tid=216378)



Easy, but not working - NewbBeginner - 25.01.2011

Код:
        Phonenumber = random(89999);
  	format(stri, sizeof(stri), "444%i", Phonenumber);
   	printf("Phone NR: %i", stri);
But it prints only 444, not this random too.


Re: Easy, but not working - legodude - 25.01.2011

what is the arraysize of stri?

This forum requires that you wait 60 seconds between posts. Please try again in 21 seconds.
FFS


Re: Easy, but not working - NewbBeginner - 25.01.2011

Код:
new
      stri[225]
;



Re: Easy, but not working - 1D10T - 25.01.2011

Correct me if i'm wrong but I think this has something to do with the stuff like %s and %d where u use the letters for a variable value like format(blablabla. "You slapped %s", GetName( playerid ). Know what I mean? I think the %i has no defined value like GetName for %s


Re: Easy, but not working - CJ101 - 25.01.2011

You do not need a sting size of 255. Use something like 100. 255 is a waste.


Re: Easy, but not working - NewbBeginner - 25.01.2011

Got it. But still, why this isnt working ?


Re: Easy, but not working - legodude - 25.01.2011

you need a phonenumber of 8 chars long rite?

Код:
	new stri[100];
	format(stri, sizeof(stri), "Your Phonenumber 444");
	for(new i;i<5;i++)
	{
	    format(stri,sizeof(stri),"%s%i",stri,random(10));
	}
   	printf("%s", stri);



Re: Easy, but not working - NewbBeginner - 25.01.2011

And someone who know Mysql well, how can I select from players database, that if there is already this kind of random number, then it will do new number and insert into database ?