18.06.2011, 08:30
So I need a little help about storing strings. My code:
So I tested with the command below:
The age shows correct, but origin is blank... So how do I store strings correctly?
Код:
if(dialogid == DIALOG_FORM_3) { if(response) { if(!IsNumeric(inputtext)) { new sl = strlen(inputtext); if(sl >= 3) { PlayerData[playerid][NewPlayer] = 0; strpack(origin[playerid][20],inputtext); ShowPlayerDialog(playerid,DIALOG_FORM_4,DIALOG_STYLE_MSGBOX,"Thank you!","That was all the information that was useful to us!\nYou can now play!","OK",""); } else { ShowPlayerDialog(playerid,DIALOG_FORM_3,DIALOG_STYLE_INPUT,"Where are you from?","(Error: Invalid country - too short)\nPlease, enter a countrys' name you're from: ","OK",""); Kick(playerid); } } else { ShowPlayerDialog(playerid,DIALOG_FORM_3,DIALOG_STYLE_INPUT,"Where are you from?","(Error: Invalid country - numbers not allowed)\nPlease, enter a countrys' name you're from: ","OK",""); } } }
Код:
COMMAND:test(playerid, params[]) { new string[128]; format(string,sizeof(string), "age %d, origin %s", PlayerData[playerid][Age],PlayerData[playerid][Origin]); SendClientMessage(playerid, 0xfffffff,string); return 1; }