SA-MP Forums Archive
Why is that? [NOOB QUESTION] - 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)
+--- Thread: Why is that? [NOOB QUESTION] (/showthread.php?tid=576984)



Why is that? [NOOB QUESTION] - MarcGonzales - 08.06.2015

PHP код:
new Float:RandomSpawn[][4] =
{
    
// Positions, (X, Y, Z and Facing Angle)
    
{-2796.98541224.818020.5429192.0335},
    {-
2454.2170503.875930.0790267.2932},
    {-
2669.7322, -6.08746.132889.8853}
};
 
 
public 
OnPlayerSpawn(playerid)
{
    new 
rand random(sizeof(RandomSpawn));
 
    
// SetPlayerPos to the random spawn data
    
SetPlayerPos(playeridRandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
 
    
// SetPlayerFacingAngle to the random facing angle data
    
SetPlayerFacingAngle(playeridRandomSpawn[rand][3]);
    return 
1;

Here is the code, now, why do we insert two arrays
PHP код:
new Float:RandomSpawn[FONT="System"][][4][/FONT
Also, what is the use of the first array and how to differ it from the other?


Re: Why is that? [NOOB QUESTION] - buburuzu19 - 08.06.2015

https://sampwiki.blast.hk/wiki/Float


Re: Why is that? [NOOB QUESTION] - MarcGonzales - 08.06.2015

lol, what?


Re: Why is that? [NOOB QUESTION] - JaydenJason - 08.06.2015

Quote:
Originally Posted by iPLEOMAX
Note: If you declare a string with no size, the precompiler will automatically set the size according to what you have initialized it with.
Example:

Код:
new something[] = "YAY!"; 
//it becomes:
new something[5] = "YAY!";
https://sampforum.blast.hk/showthread.php?tid=318212