Variables in Pawno.
#1

Hello, I'm having the hardest time in the world grasping variables in pawno, they are much more complicated then other languages IMO.

How in the world do you define an int and a string? My guess is
Код:
new pScore[3] = 0; //Int
new pSkin[MAX_PLAYERS] //String
Also, how do you use variables in functions for example
Код:
SetPlayerSkin(playerid, pSkin);
doesn't compile for me.

another thing I'm struggling to understand is having a variable for every player, I know you use MAX_PLAYERS for this but could someone dumb it down for me?


EDIT: Got it compiling by changing the the variables to
Код:
new	pScore[MAX_PLAYERS] = 0; //Score
new pSkin[MAX_PLAYERS] = 0; // Skin
Код:
SetPlayerSkin(playerid, pSkin[playerid]);
Are my variables ints because I set them to 0? are they strings if I don't set them to 0?
Reply
#2

Take a look here https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables
Reply
#3

All strings (except literal) are arrays, but not all arrays are strings.
pawn Код:
new myString[6] = "Hello";
new myString[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
new myString[6] = {72, 101, 108, 108, 111, 0};
Are all equivalent.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)