SA-MP Forums Archive
strmid Bug - 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: strmid Bug (/showthread.php?tid=529879)



strmid Bug - E_Meec - 04.08.2014

I have this code:
pawn Код:
Cut = strlen(RemovePlayerUnderscoreString(playerName(playerid))) + 7 + 64;
strmid(cString, text, Cut, strlen(text));
And when I try to print the content of cString I get blank why?


Re: strmid Bug - Stinged - 04.08.2014

https://sampwiki.blast.hk/wiki/Strmid
Is Cut 'start' and where's the end?


Re: strmid Bug - E_Meec - 04.08.2014

strlen(text) is the end.


Re: strmid Bug - Dignity - 04.08.2014

What is the size of

pawn Код:
RemovePlayerUnderscoreString(playerName(playerid)) + 7 + 64
and "cString"?


Re: strmid Bug - E_Meec - 04.08.2014

This is the script:
pawn Код:
new cString[128];
    new Cut;
    if(strlen(text) > 64)
    {
        Cut = strlen(RemovePlayerUnderscoreString(playerName(playerid))) + 7 + 64;
        strmid(cString, text, Cut, strlen(text));
        printf("%s", cString);
        strdel(text, 64, 128);
        format(text, 128, "%s says: %s..", RemovePlayerUnderscoreString(playerName(playerid)), text);
        format(cString, 128, "..%s", cString);
        ProxDetector(20.0, playerid, text,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        ProxDetector(20.0, playerid, cString,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }



Re: strmid Bug - Dignity - 04.08.2014

I'm not really sure why it's blank but it's most likely blank because "cString" contains nothing.

RemovePlayerUnderscoreString(playerName(playerid)) + 7 + 64 is 95. (assuming RemovePlayerUnderscoreString is size 24, aka MAX_PLAYER_NAME).

Are you sure your text is atleast 95 characters?


Re: strmid Bug - E_Meec - 04.08.2014

Yes I am