Text in string - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Text in string (
/showthread.php?tid=225010)
Text in string -
Steve M. - 12.02.2011
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?
Re: Text in string -
Mean - 12.02.2011
And, what is your PlayerAccount[playerid][Origin]? Try using a %d (integ)
Re: Text in string -
Steve M. - 12.02.2011
It is a string.
Код:
enum pAcc
{
Origin[13]
}
new PlayerAccount[MAX_PLAYERS][pAcc];
Re: Text in string -
Mean - 13.02.2011
And, where do you set it? Like PlayerAccount[ playerid ][ Origin ] = something; ?
Re: Text in string -
Hiddos - 13.02.2011
What about
:
pawn Код:
strmid(PlayerAccount[playerid][Origin], "Los Santos", 0, 12);
Re: Text in string -
SkizzoTrick - 13.02.2011
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"; }
Re: Text in string -
Steve M. - 13.02.2011
@Hiddos It's not working.
@SkizzoTrick I know that solution, but I was searching to do it this way, with text.
Re: Text in string -
JaTochNietDan - 13.02.2011
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.
Re: Text in string -
Steve M. - 16.02.2011
Okay, thanks JaTochNietDan!