Write Error
#1

Could Someone help me here please i want it to write Text and not Numeric numbers i had it working earlier then the Mode released Oh crap i was a post to look for numbers then it messed up and only registers numbers for example i wanted it to Write John instead tould me my error messages about Can not contain numbers text only so i put 23John it wrote 23 in my user ini file

I changed the strval to strlen On dialog and changed the forward function to dini_intSet To dini_Set

It fixed the above error but Now there a new problem Its Counting My text So my Firstname = Was apost to be John But was Firstname=4

pawn Код:
if(dialogid == 5)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
        SpawnPlayer(playerid);
        if(!strlen(inputtext))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "Your  Firstname Cannot Contain Numbers or be Blank Text Only");
            ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Firstname","What is your firstname?","Submit","Cancel");
            return 1;
        }
        if(!response){ Kick(playerid); PlayerInfo[playerid][pReg] = 1; return 1; }
        if(strlen(inputtext) == 0)
        {
            SendClientMessage(playerid, ORANGE, "Invalid Name Max letters 20.");
            ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Firstname","What is your firstname?","Submit","Cancel");
            return 1;
        }
        FirstNameSection(playerid, strlen(inputtext));
        PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
        TogglePlayerControllable(playerid, 0);
        format(string, 128, "Okay So You're First Names is %s ", inputtext);
        SendClientMessage(playerid, DARKBLUE, string);
        ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Lastname","What is your lastname?","Submit","Cancel");
    }
forward FirstNameSection(playerid, Firstname);
My Forward Function
pawn Код:
public FirstNameSection(playerid, Firstname)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    PlayerInfo[playerid][pFirstname] = Firstname;
    dini_Set(file, "Firstname",PlayerInfo[playerid][pFirstname]);
    return 1;
}
Reply
#2

I sure wish i didnt half to bump this but I need help BAD!
Reply
#3

Instead of forwarding and public's use stock for that.

pawn Код:
stock FirstNameSection(playerid, bool:Firstname) //Not sure if this would work :S
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    name = Firstname;
    dini_Set(file, "Firstname",Firstname);
    return 1;
}
Reply
#4

pawn Код:
new full = strlen(inputtext);
for(new i = 0; i < full; i++)
    {
        if(IsNumeric(inputtext[i]))
         {
          SendClientMessage(playerid, 0xFFFFFFFF, "Your  Firstname Cannot Contain Numbers or be Blank Text Only");
            ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Firstname","What is your firstname?","Submit","Cancel");
          return 0;
         }
    }

pawn Код:
stock IsNumeric(string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by gr56
Посмотреть сообщение
pawn Код:
new full = strlen(inputtext);
for(new i = 0; i < full; i++)
    {
        if(IsNumeric(inputtext[i]))
         {
          SendClientMessage(playerid, 0xFFFFFFFF, "Your  Firstname Cannot Contain Numbers or be Blank Text Only");
            ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Firstname","What is your firstname?","Submit","Cancel");
          return 0;
         }
    }

pawn Код:
stock IsNumeric(string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Hmm I never did much with stocks Could you explain how to do that better if i done them right i got errors for both ideals sorry i wished it worked ...
Reply
#6

Show errors
Reply
#7

Bump Bump Bump!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)