[Ajuda] Como usar random ?
#1

Toda vez que e comprado um carro ele e criado em uma coordenada, mas eu queria troca essa coordenada por random
PHP код:
    ShopCar[playerid] = CreateVehicle(CarModels[0], 1410.9203,-1670.4672,13.63000.0color1color26000000); 
Ok, criei a random:
PHP код:
new Float:nconce[23][23] =
{
    {
1414.5581,-1695.7085,13.2064},
    {
1408.7383,-1695.4691,13.2065},
    {
1400.7585,-1695.0276,13.1997},
    {
1394.1831,-1695.8801,13.2064},
    {
1388.4677,-1695.8420,13.1989},
    {
1381.4811,-1695.9290,13.2065},
    {
1375.2864,-1695.9102,13.2065},
    {
1366.5824,-1695.5266,13.2084},
    {
1350.7893,-1707.4825,13.2013},
    {
1355.3280,-1707.1072,13.2024},//part1, ate car11
    
{1364.0573,-1706.1354,13.2005},
    {
1368.5592,-1705.1416,13.2008},
    {
1372.7957,-1704.8080,13.2054},
    {
1377.4561,-1706.8342,13.1899},
    {
1382.2820,-1707.1516,13.2021},
    {
1386.4211,-1705.0719,13.2008},
    {
1390.4382,-1705.5377,13.1950},
    {
1395.1823,-1706.8774,13.2022},//Parte2, ate car19
    
{1399.5963,-1706.8491,13.2057},
    {
1403.8511,-1707.5972,13.2032},
    {
1407.7688,-1706.5420,13.2016},
    {
1412.3535,-1706.5269,13.2044},
    {
1405.3660,-1695.1024,13.2070}
}; 
como devo usa-la no lugar das coordenadas do cmd ?
Reply
#2

isso ira te ajudar
Reply
#3

Ja tentei :/, eu fiz a random pela wiki, eu queria sabe como usa-la aki !
pawn Код:
ShopCar[playerid] = CreateVehicle(CarModels[0], 1410.9203,-1670.4672,13.6300, 0.0, color1, color2, 6000000);
Se tipo e dessa maneira que devo usar !
pawn Код:
new rand = random(sizeof(nconce));
    ShopCar[playerid] = CreateVehicle(CarModels[0], nconce[rand][0], 0.0, color1, color2, 6000000);
'-
Reply
#4

Vocк nгo soube usar o rand direito!

pawn Код:
new Float:nconce[23][3] =
{
    {1414.5581,-1695.7085,13.2064},
    {1408.7383,-1695.4691,13.2065},
    {1400.7585,-1695.0276,13.1997},
    {1394.1831,-1695.8801,13.2064},
    {1388.4677,-1695.8420,13.1989},
    {1381.4811,-1695.9290,13.2065},
    {1375.2864,-1695.9102,13.2065},
    {1366.5824,-1695.5266,13.2084},
    {1350.7893,-1707.4825,13.2013},
    {1355.3280,-1707.1072,13.2024},//part1, ate car11
    {1364.0573,-1706.1354,13.2005},
    {1368.5592,-1705.1416,13.2008},
    {1372.7957,-1704.8080,13.2054},
    {1377.4561,-1706.8342,13.1899},
    {1382.2820,-1707.1516,13.2021},
    {1386.4211,-1705.0719,13.2008},
    {1390.4382,-1705.5377,13.1950},
    {1395.1823,-1706.8774,13.2022},//Parte2, ate car19
    {1399.5963,-1706.8491,13.2057},
    {1403.8511,-1707.5972,13.2032},
    {1407.7688,-1706.5420,13.2016},
    {1412.3535,-1706.5269,13.2044},
    {1405.3660,-1695.1024,13.2070}
};

    new rand = random(sizeof(nconce));
    ShopCar[playerid] = CreateVehicle(CarModels[0], nconce[rand][0],nconce[rand][1],nconce[rand][2], 0.0, color1, color2, 6000000);
Reply
#5

Blzsw Vlw, =D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)