Crash - 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: Crash (
/showthread.php?tid=575855)
Crash -
kalanerik99 - 30.05.2015
HEllo!
I have this code
Код:
new Vehcolor1 = randomEx(0,255);
new Vehcolor2 = randomEx(0,255);
Why pawno wonts to compile (crash)
I use them like
Код:
veh1[playerid] = CreateVehicle(model,x+1,y+1,z,a,Vehcolor1,Vehcolor2,-1);
...
....
....
Re: Crash -
FplayerGR - 30.05.2015
try this:
Код:
new vehcolor1 = random(255);
new vehcolor2 = random(255);
veh1[playerid] = CreateVehicle(model,x+1,y+1,z,a,vehcolor1,vehcolor2,-1);
...
...
...
Re: Crash -
kalanerik99 - 30.05.2015
No its not working
Problem is in this
Код:
stock randomEx(min, max)
{
new rand = random(max-min)+min;
return rand;
}
Re: Crash -
Yashas - 30.05.2015
You cannot call functions while declaring global variables.
This code won't work:
Код:
new global_var = random(255);
main()
{
}
Correct Way
Код:
new global_var;
main()
{
global_var = random(255);
}
But you can call functions while declaring local variables.This code will work:
Код:
main()
{
new global_var = random(255);
}
Re: Crash -
kalanerik99 - 30.05.2015
I use it for vehicle saving system soo I need them like that to store the color
Re: Crash -
Yashas - 30.05.2015
You can't assign values by calling functions when you declare variables in the global scope.
Add these to main():
Код:
vehcolor1 = random(255);
new vehcolor2 = random(255);
Change this:
Код:
new Vehcolor1 = randomEx(0,255);
new Vehcolor2 = randomEx(0,255);
to
Код:
new Vehcolor1;
new Vehcolor2;
Re: Crash -
kalanerik99 - 30.05.2015
fixed