Help Need Help
#5

Strval has one parameter, in that parameter you put the string you want to convert into an integer instead.
pawn Код:
new string[4] = "255"; // This is just made up of characters.
new variable = 255; // This is a number.
So the code below wont work....The string is 255, but it is just a string, not a number.
pawn Код:
GivePlayerMoney(playerid, string);
Instead you would use strval to convert the string into a number.

pawn Код:
new string[4] = "400";
GivePlayerMoney(playerid, strval(string)); // This converts the string into the number 400 and will give the player the money.
Strlen just counts the characters in a string, and returns an integer.

Example.
pawn Код:
new string[11] = "Hello John";
printf("String has %d characters in it.",strlen(string));
Will print
Код:
String has 10 characters in it. Since there are 10 chars in the string.
Hope I helped.
Reply


Messages In This Thread
Help Need Help - by RicaNiel - 10.04.2012, 23:38
Re: Help Need Help - by ReneG - 10.04.2012, 23:44
Re: Help Need Help - by RicaNiel - 10.04.2012, 23:46
Re: Help Need Help - by ViniBorn - 10.04.2012, 23:57
Re: Help Need Help - by ReneG - 11.04.2012, 00:00
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:03
Re: Help Need Help - by ReneG - 11.04.2012, 00:05
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:06
Re: Help Need Help - by ReneG - 11.04.2012, 00:18
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:33

Forum Jump:


Users browsing this thread: 3 Guest(s)