Jump to content

[2]Variabile


Gireada

Recommended Posts

In acest tutorial va voi explica tipul variabilelor.

In Pawno exista 3 tipuri de variabile(text,intregi,float)

1.Text

Variabilele de tip text sunt defapt tablouri in care se stocheaza fiecare caracter.

Sa va dau un exemplu vrem sa stocam cuvantul salut, vom avea nevoie de functia format

new text[5];
format(text, sizeof(text), "salut");
Se vor stoca astfel ae0j.jpg2.Intregi Sunt variabilele de tip intreg adica fara virgula sau punct. Exemplu:
new variabila = 5;
printf("%d",variabila);
Ne va afisa in consola valoarea variabilei adica 5. 3.Float Este variabila cu punct sau virgula. O folosim deobicei cand vrem sa afla coordonate, viata sau armura. Exemplu, vrem sa afla coordonatele jucatorului:
new Float:x, Float:y, Float:z
GetPlayerPos(playerid, x,y,z);
printf("%f x, %f y, %f, z", x,y,z);

Ne va afisa in consola coordonatele jucatorului. Acuma daca sa zicem ca coordonatele jucatorului sunt 24.77 , 43.66 , 66.43 ; daca nu am fi folosit Float: ne ar fi afisat 24 43 66

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
  • 3 weeks later...
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.