problem with strmid - 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)
+--- Thread: problem with strmid (
/showthread.php?tid=458300)
problem with strmid -
avivelkayam - 15.08.2013
hello guys!
sorry about my english..
i tried to cut my String but i cant store it in the variable..
(btw, im doing this cut to cut the \r\n)
Код:
new File:myfile = fopen(file(playerid), io_read);
while (fread(myfile, String))
{
if(!strcmp(String, "IP", false, strlen("IP")))
strmid(PlayerInfo[playerid][IP], String, strlen("IP="), strlen(String) - 2);
}
this is the code
i did some checks and i saw that the variable PlayerInfo[playerid][IP] does not have any value ( i mean "")
so i tried another way:
Код:
new File:myfile = fopen(file(playerid), io_read);
while (fread(myfile, String))
{
if(!strcmp(String, "IP", false, strlen("IP")))
{
new string[100];
strmid(string, String, strlen("IP="), strlen(String) - 2);
format(PlayerInfo[playerid][IP], 20, string);
}
}
and now it works!
my question is why in the first try it ddidnt work?
btw the enum is:
Код:
enum pInfo
{
...
IP[30],
...
}
the variable is:
Код:
new PlayerInfo[MAX_PLAYERS][IP]
thanks for all helpers
Re: problem with strmid -
avivelkayam - 17.08.2013
BUMP!