Value -> String [ REP + ]
#1

Hey dear guys!


I need help, how i am enable to do, for example i have:

PlayerInfo[playerid][Carschool]

if it is set to 0, it will show in my /stats command "Not owned" and if it is set to 1, it will show "Owned"

Like how i am enable to do it, thank you guys!
Reply
#2

PHP код:
new owned[10];
if(
PlayerInfo[playerid][Carschool] == 1owned "Owned";
else 
owned "Not Owned"
Easy as that!
Reply
#3

Well, i did it just like you helped me but.

When i inserted it in my /stats command, like this:

Код:
format(str,sizeof(str),"{FFFFFF}Carschool: {00FF80}%s\n",PlayerInfo[playerid][Carschool]);
strcat(string, str);
It was showing literaly nothing in the /stats command, like i mean there was all other stuff, but in "Carschool" after the : there was nothing, it was just blank space.
Reply
#4

You need to insert the string 'owned' instead of the integer ..[Carschool].
pawn Код:
format(str,sizeof(str),"{FFFFFF}Carschool: {00FF80}%s\n", owned);
strcat(string, str);
Reply
#5

Ohh, i am blind noob. Sorry for that.. and thank you verry much! REP+ to both of you guys.
Reply
#6

Hello!

You can do also this:
PHP код:
format(str,sizeof(str),"{FFFFFF}Carschool: {00FF80}%s\n",(PlayerInfo[playerid][Carschool]) ? ("Owned") : ("Not owned"));
strcat(stringstr); 
You needn't do this if you use my code:
PHP код:
new owned[10];
if(
PlayerInfo[playerid][Carschool] == 1owned "Owned";
else 
owned "Not Owned"
Mencent
Reply
#7

Well, thank you for the support but i will rather use the code, which is already working for me and i really understand it and know, what is going on. I for some reason cant understand why, and how you putted there the names and such, so i will better use something that i understand and have no problems with it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)