About inputtext
#1

pawn Код:
FactionTag[GetPlayerFactionID(playerid)] = inputtext;
Код:
error 047: array sizes do not match, or destination array is too small
What the actual fuck is wrong with that fucking code? I fucking spent for a fucking hour already.

pawn Код:
//array sizes almost same
    FactionTag[MAX_GROUPS][10],
Reply
#2

pawn Код:
format(FactionTag[GetPlayerFactionID(playerid)],sizeof(FactionTag[GetPlayerFactionID(playerid)]),"%s",inputtext);
Reply
#3

C:\Documents and Settings\eros\Desktop\SA-MP Server\gamemodes\groupsystem.pwn(513) : error 001: expected token: "]", but found "-identifier-"
C:\Documents and Settings\eros\Desktop\SA-MP Server\gamemodes\groupsystem.pwn(513) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\eros\Desktop\SA-MP Server\gamemodes\groupsystem.pwn(513) : error 029: invalid expression, assumed zero
C:\Documents and Settings\eros\Desktop\SA-MP Server\gamemodes\groupsystem.pwn(513) : fatal error 107: too many error messages on one line
Reply
#4

You can't assign a string in this manner in Pawn. For all you know, someone inputs "MyVeryLongTag". This is obviously longer than 10 characters. Then what?

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
pawn Код:
format(FactionTag[GetPlayerFactionID(playerid)],sizeof(FactionTag[GetPlayerFactionID(playerid)]),"%s",inputtext);
Don't use format to copy strings, use strcat or strcpy.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
I put this into the string.inc library:
pawn Код:
/*
native strcpy(dest[], const source[], maxlength=sizeof dest);
*/
Function:

pawn Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    strcat((dest[0] = EOS, dest), source, maxlength);
}
Use it.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)