#include <a_samp> new Normal_Cars[]= {401,402,404,405,410,412,413,418,419,421, 422,426,436,439,445,458,466,467,474,475,478,479,480,489,491,492,496,507, 516,517,518,526,527,529,533,534,536,542,543,546,547,549,550,551,554,558, 561,566,575,576,580,585,600}; // Normal Cars new Bicycles[] = {509,481,510}; new NRandom = random(sizeof(Normal_Cars)); // Random Normal Cars new BRandom = random(sizeof(Bicycles)); // Random bicycles public OnFilterScriptInit() { AddStaticVehicle(NRandom,1836.7377,-1854.2983,13.1691,358.8890,0,1); // cheapcar1 AddStaticVehicle(NRandom,1841.1429,-1870.9862,13.1690,180.3903,0,1); // cheapcar2 AddStaticVehicle(NRandom,1791.4736,-1888.7665,13.1774,178.7570,0,1); // normalcar1 AddStaticVehicle(NRandom,1778.0460,-1913.4692,13.1675,275.8655,0,1); // normalcar2 AddStaticVehicle(NRandom,1802.2800,-1915.4110,13.1742,273.1066,0,1); // normalcar3 AddStaticVehicle(418,1922.2260,-1860.6227,13.3405,168.1871,0,1); // somevan AddStaticVehicle(BRandom,1881.0487,-1887.8309,13.2597,89.8009,0,1); // bikecycle1 AddStaticVehicle(NRandom,1826.8505,-1797.0966,13.2413,0.7763,0,1); // norcar4 AddStaticVehicle(NRandom,1816.2935,-1796.4451,13.2409,181.2451,0,1); // norcar6 AddStaticVehicle(587,1717.8387,-1737.7451,13.2408,270.3658,0,1); // sportcar AddStaticVehicle(459,1782.3186,-1701.4119,13.2818,6.8769,0,1); // workcar AddStaticVehicle(498,1765.7163,-1692.0504,13.2076,92.0528,0,1); // vanwork AddStaticVehicle(NRandom,1742.8043,-1693.8945,13.3243,178.1735,0,1); // normalcar return 1; } public OnFilterScriptExit() { return 1; }
new Bicycles[] = {509,481,510};
new Random; // GOOD
OneCallback()
{
new Random; // BAD
}
new NRandom = random(sizeof(Normal_Cars)); // Random Normal Cars new BRandom = random(sizeof(Bicycles)); // Random bicycles
#include <a_samp> new Normal_Cars[]= {401,402,404,405,410,412,413,418,419,421, 422,426,436,439,445,458,466,467,474,475,478,479,480,489,491,492,496,507, 516,517,518,526,527,529,533,534,536,542,543,546,547,549,550,551,554,558, 561,566,575,576,580,585,600}; // Normal Cars new Bicycles[] = {509,481,510}; public OnFilterScriptInit() { new NRandom = random(sizeof(Normal_Cars)); // Random Normal Cars new BRandom = random(sizeof(Bicycles)); // Random bicycles AddStaticVehicle(Normal_Cars[NRandom],1836.7377,-1854.2983,13.1691,358.8890,0,1); // cheapcar1 AddStaticVehicle(Normal_Cars[NRandom],1841.1429,-1870.9862,13.1690,180.3903,0,1); // cheapcar2 AddStaticVehicle(Normal_Cars[NRandom],1791.4736,-1888.7665,13.1774,178.7570,0,1); // normalcar1 AddStaticVehicle(Normal_Cars[NRandom],1778.0460,-1913.4692,13.1675,275.8655,0,1); // normalcar2 AddStaticVehicle(Normal_Cars[NRandom],1802.2800,-1915.4110,13.1742,273.1066,0,1); // normalcar3 AddStaticVehicle(418,1922.2260,-1860.6227,13.3405,168.1871,0,1); // somevan AddStaticVehicle(Bicycles[BRandom],1881.0487,-1887.8309,13.2597,89.8009,0,1); // bikecycle1 AddStaticVehicle(Normal_Cars[NRandom],1826.8505,-1797.0966,13.2413,0.7763,0,1); // norcar4 AddStaticVehicle(Normal_Cars[NRandom],1816.2935,-1796.4451,13.2409,181.2451,0,1); // norcar6 AddStaticVehicle(587,1717.8387,-1737.7451,13.2408,270.3658,0,1); // sportcar AddStaticVehicle(459,1782.3186,-1701.4119,13.2818,6.8769,0,1); // workcar AddStaticVehicle(498,1765.7163,-1692.0504,13.2076,92.0528,0,1); // vanwork AddStaticVehicle(Normal_Cars[NRandom],1742.8043,-1693.8945,13.3243,178.1735,0,1); // normalcar return 1; } public OnFilterScriptExit() { return 1; }
new Bicycles[] = {509,481,510};
new Bicycles[] {
{509},
{401},
{510}
}
Originally Posted by BiG_Sm0k3
this
pawn Код:
pawn Код:
|
Originally Posted by clavador
Quote:
Ask around. |
Originally Posted by clavador
I've found a working way, but every car is the same:
|
new size = sizeof(Normal_Cars);
AddStaticVehicle(Normal_Cars[random(size)], .....);
AddStaticVehicle(Normal_Cars[random(size)], .....);
AddStaticVehicle(Normal_Cars[random(size)], .....);
AddStaticVehicle(Normal_Cars[random(size)], .....);
......
Originally Posted by clavador
I still don't know why it fails to compile when I use the Randoms Outside the Callbacks.
|
Originally Posted by pawn-lang.pdf
A global declaration appears outside a function and a global variable
is accessible to any function. Global data objects can only be initialized with constant expressions. |
Originally Posted by ZeeX
Quote:
pawn Код:
Quote:
Quote:
|