SA-MP Forums Archive
Variables for Beginners - 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: Variables for Beginners (/showthread.php?tid=92610)



Variables for Beginners - [ERP]Snow - 21.08.2009

new;

Код:
new MyCar;
- This is creating a new variable which can be used in many ways, for example.

Код:
MyCar = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
- Or for you to have more vehicles you can use this.

Код:
new MyCar[5];
Код:
MyCar[0] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[1] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[2] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[3] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[4] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
Interesting Functions

- These are interesting Variables i myself like to use.

Код:
/ = Divide
* = Times
+ = Plus (Obvious)
- = Minus (Obvious)
> = Above Number
< = Below Number
>= = Above or equal to
<= = Below or equal to
|| = or
&& = and
true = if the problem is true
false = if the problem is false
- I will try an example

Код:
new MyNumber = 20;
new Result; // Is 18

Result = MyNumber *10 / 5 + 3 - 5;

if(Result >= 18 || < 19 && true) { return print("Hello!"); return 1; }
- If the result is above or equal to 18 and is below the number 19 and it is true

Got bored and will add more information later when i come home.

EDIT: I'll add array's later :P


Re: Variables for Beginners - MenaceX^ - 21.08.2009

I think everyone knows how.. Though what you did for the vehicles was made by someone else a few days ago..
pawn Код:
MyCar[1] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[2] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[3] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
MyCar[4] = CreateVehicle(ID, Float:X, Float:Y, Float:Z, 0, 0, -1);
You forgot the mycar[0].


Re: Variables for Beginners - [ERP]Snow - 21.08.2009

Eh.. I don't really care about 0, not much of a difference, thanks anyway