Text in string
#1

Hey, guys!

This is my code:
Код:
strmid(PlayerAccount[playerid][Origin], "Los Santos", 0, 13);
printf("Origin: %s", PlayerAccount[playerid][Origin]);
And it doesn't print anything. Any ideas how to fix it?
Reply
#2

And, what is your PlayerAccount[playerid][Origin]? Try using a %d (integ)
Reply
#3

It is a string.

Код:
enum pAcc
{
       Origin[13]
}
new PlayerAccount[MAX_PLAYERS][pAcc];
Reply
#4

And, where do you set it? Like PlayerAccount[ playerid ][ Origin ] = something; ?
Reply
#5

What about:
pawn Код:
strmid(PlayerAccount[playerid][Origin], "Los Santos", 0, 12);
Reply
#6

Why don't you just use numbers,and detect them using strings xD

like PlayerInfo[playerid][Origin] = 1;
pawn Код:
new otext[51];
if(PlayerInfo[playerid][Origin] == 1){ otext = "Los Santos"; }
else if(PlayerInfo[playerid][Origin] == 2){ otext = "San Fierro"; }
else if(PlayerInfo[playerid][Origin] == 3){ otext = "Las Venturas"; }
Reply
#7

@Hiddos It's not working.

@SkizzoTrick I know that solution, but I was searching to do it this way, with text.
Reply
#8

You could use format, like so:

pawn Код:
format(PlayerInfo[playerid][Origin],13,"Los Santos");
I believe the problem lies within how enumerated strings are handled though.
Reply
#9

Okay, thanks JaTochNietDan!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)