"strlen"?? help please... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: "strlen"?? help please... (
/showthread.php?tid=157971)
"strlen"?? help please... -
introzen - 08.07.2010
Hey everyone. I've made a bank system using dialogs.. now i want to check the lenght of the bank ID... but I get an error:
pawn Код:
if(dialogid == BANKCREATE)
{
if(response)
{
new BankID = strval(inputtext[0]);
new length = strlen(BankID); //ERROR LINE
for(new b=0; b<MAX_BANKS; b++)
{
if(BankInfo[b][bBankID] == BankID) return ShowPlayerDialog(playerid,BANKCREATE+1,DIALOG_STYLE_MSGBOX,"San Fierro Bank System","That bank account is already being used","Back","Cancel");
}
if(length != 10) return ShowPlayerDialog(playerid,BANKCREATE+2,DIALOG_STYLE_MSGBOX,"San Fierro Bank System","Invalid Account ID. Please use a 10-digit Account","Back","Cancel");
dini_IntSet(Playerfile(playerid),"BankID",BankID);
dini_Create(Bankfile(BankID));
dini_IntSet(Bankfile(BankID),"BankID",BankID);
ShowPlayerDialog(playerid,BANKCREATE+3,DIALOG_STYLE_INPUT,"San Fierro Bank System","Type in a 4-digit password for your account:","Select","Cancel");
}
return 1;
}
Код:
error 035: argument type mismatch (argument 1)
Re: "strlen"?? help please... -
MenaceX^ - 08.07.2010
What is inside the strlen must be a string, not an integer
Re: "strlen"?? help please... -
introzen - 08.07.2010
How to check the length of an integer then?
Re: "strlen"?? help please... -
Hiddos - 08.07.2010
Put it in a string first then get the length.
pawn Код:
new BankID = strval(inputtext);
new length = strlen(inputtext);
Re: "strlen"?? help please... -
MenaceX^ - 08.07.2010
BankID!=10..
Re: "strlen"?? help please... -
introzen - 08.07.2010
Okey, Now I got a bigger problem... Solved the one with counting the digits...
Now, sometimes it doesn't save the account, and if it saves, it saves it as wrong account ID...
What's wrong?
pawn Код:
if(dialogid == BANKCREATE)
{
if(response)
{
if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid,BANKCREATE+2,DIALOG_STYLE_MSGBOX,"San Fierro Bank System","Invalid Account ID. Please use a 10-digit Account","Back","Cancel");
new BankID = strval(inputtext[0]);
new length = strlen(inputtext[0]);
for(new b=0; b<MAX_BANKS; b++)
{
if(BankInfo[b][bBankID] == BankID) return ShowPlayerDialog(playerid,BANKCREATE+1,DIALOG_STYLE_MSGBOX,"San Fierro Bank System","That bank account is already taken","Back","Cancel");
}
if(length != 10) return ShowPlayerDialog(playerid,BANKCREATE+2,DIALOG_STYLE_MSGBOX,"San Fierro Bank System","Invalid Account ID. Please use a 10-digit Account","Back","Cancel");
dini_IntSet(Playerfile(playerid),"BankID",BankID);
PlayerInfo[playerid][pBankID] = BankID;
BankInfo[BankID][bBankID] = BankID;
dini_Create(Bankfile(BankID));
dini_IntSet(Bankfile(BankID),"BankID",BankID);
ShowPlayerDialog(playerid,BANKCREATE+3,DIALOG_STYLE_INPUT,"San Fierro Bank System","Type in a 4-digit password for your account:","Select","Cancel");
}
return 1;
}