SA-MP Forums Archive
Trouble using strmid function - 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: Trouble using strmid function (/showthread.php?tid=175062)



Trouble using strmid function - Germanator - 08.09.2010

Hi everyone.

After upgrading my server to 0.3b i started to get problems with the strmid function. I'm not sure what's causing it. I have very old functions using it that haven't been changed but now strmid sometimes just doesnt extract it at all.
One example code that has stopped working:
Код:
strmid(PlayerInfo[playerid][pKey], inputtext, 0, strlen(inputtext), 255);
strmid simply deletes any info inside the Destination. After this code executes pKey = "" .
It doesn't ALWAYS happen. But too often to ignore.
Anyone have any ideas what might be causing it?


Re: Trouble using strmid function - Rachael - 08.09.2010

is 255 the size of your [pKey] array?


Re: Trouble using strmid function - Voldemort - 08.09.2010

Check Dialog IDs, maybe you have two dialogs with same ID, and in that duplicated ID dont have inputtext


Re: Trouble using strmid function - Germanator - 08.09.2010

No there is no double used dialogs. and the size of pKey is 127. I'm gonna try changing it see what happens.


Re: Trouble using strmid function - Rachael - 08.09.2010

I don't know what pKey is in your script, I'm assuming it is a password? I'm a big fan of saving memory by optimizing the size of variables ( ie making them no larger than they need to be )

Regardless of this, you should probably make the last number in your strmid function 127 ( aka sizeof(pkey)


Re: Trouble using strmid function - HadFuny - 08.09.2010

Try changing the size of pKey to 500 or something.