11.04.2012, 00:00
Strval has one parameter, in that parameter you put the string you want to convert into an integer instead.
So the code below wont work....The string is 255, but it is just a string, not a number.
Instead you would use strval to convert the string into a number.
Strlen just counts the characters in a string, and returns an integer.
Example.
Will print
Hope I helped.
pawn Код:
new string[4] = "255"; // This is just made up of characters.
new variable = 255; // This is a number.
pawn Код:
GivePlayerMoney(playerid, string);
pawn Код:
new string[4] = "400";
GivePlayerMoney(playerid, strval(string)); // This converts the string into the number 400 and will give the player the money.
Example.
pawn Код:
new string[11] = "Hello John";
printf("String has %d characters in it.",strlen(string));
Код:
String has 10 characters in it. Since there are 10 chars in the string.