case DIALOG_PB_EDITPW:
{
if(isnull(inputtext)) return ShowPlayerDialog(playerid, DIALOG_PB_EDITPW, DIALOG_STYLE_INPUT, ""COL_WHITE"Setting Paintball password", ""COL_WHITE"First 4 characters are going to be the password:\n\n"COL_RED"The password must be at least 4 characters.", "Select", "Done");
if(strlen(inputtext) < 4) return ShowPlayerDialog(playerid, DIALOG_PB_EDITPW, DIALOG_STYLE_INPUT, ""COL_WHITE"Setting Paintball password", ""COL_WHITE"First 4 characters are going to be the password:\n\n"COL_RED"The password must be at least 4 characters.", "Select", "Done");
new string[128], pbid = pInfo[playerid][InPBLobby], pw[4];
strmid(pw, inputtext, 0, 3);
pbInfo[pbid][pbPassword] = pw;
format(string, sizeof(string), "You have changed the lobby password to %s.", pbInfo[pbid][pbPassword]);
NGMSG(playerid, string);
}
The size of pw has to be 5 (4 characters + 1 NULL).
Is the reason you set only the first 4 characters as password so you can copy directly with equal sign? Better use strcpy (strcat but resetting destination) for that matter. |
I'm so confused, I don't know how to use strcpy, can you help me please?
|
#if !defined strcpy
#define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)
#endif
// usage:
strcpy(destination[], const source[], maxlength = sizeof dest)
strcpy(pbInfo[pbid][pbPassword], pw, size_of_pbPassword);