strmid Bug
#1

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?
Reply
#2

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

strlen(text) is the end.
Reply
#4

What is the size of

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

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);
    }
Reply
#6

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?
Reply
#7

Yes I am
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)