Getting Player Text. Help. -
ricardo178 - 05.02.2012
Hello. I need some help in a script i am making...
I am making a bank system, where you have to create an account. I wan't it to check if the account number you type already exist or not.
Thank you.
P.S. I am using Dini.
Re: Getting Player Text. Help. - T0pAz - 05.02.2012
mysql_num_rows().
Re : Re: Getting Player Text. Help. -
ricardo178 - 05.02.2012
Quote:
Originally Posted by T0pAz
|
I use DINI.....
To check if a name exist(In Register system), it's
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "RicAdmin/users/%s.ini", name);
if (!dini_Exists(file))
But how to check if the player text exist?
My sscanf is:
pawn Код:
new number, pin;
if(!sscanf(params, "dd", number, pin))
I want to check if number already exist when pllayer try to create a new one.
Re: Getting Player Text. Help. -
milanosie - 05.02.2012
Name the file to the pin code, Then check if the file already exists
then in the player file just link Pin to the file name
Re : Re: Getting Player Text. Help. -
ricardo178 - 05.02.2012
Quote:
Originally Posted by milanosie
Name the file to the pin code, Then check if the file already exists
then in the player file just link Pin to the file name
|
The pin part i know but the first will not work because i don't know if i have a file.. The number that player type will be the number. I want it to check if the number that player type exist..
Player can even type /createaccount 1455552553 4444 and it should check if that number exit or not..
I am defining it with "number" as you can see in sscanf params.
I want it to check like:
if(!dini_Exists(number.ini[])
But this will just not work, cos player isn't typing "number" but yes a real number...
How to make it that %d is the number? So i can if(!dini_Exists(%d.ini[])
I want to check if the banka ccount already exist, not if the pin is right. Cos all accounts have a file, and all players can just deposit money there if they know acc number, and withdraw if they know the pin.
Re: Getting Player Text. Help. -
milanosie - 05.02.2012
format(file, sizeof(file), "RicAdmin/%d.ini", number)
if(fexist(file))
Re : Getting Player Text. Help. -
ricardo178 - 05.02.2012
Thank you very much.
Re : Getting Player Text. Help. -
ricardo178 - 05.02.2012
Little problem...
Now creating the file, this line give me Un-Defined symbol(d)...
pawn Код:
dini_IntSet(file, "Pin", %d, pin);
Re: Re : Getting Player Text. Help. -
milanosie - 05.02.2012
Quote:
Originally Posted by ricardo178
Little problem...
Now creating the file, this line give me Un-Defined symbol(d)...
pawn Код:
dini_IntSet(file, "Pin", %d, pin);
|
dini_IntSet(file, "Pin", pin);
Re : Getting Player Text. Help. -
ricardo178 - 05.02.2012
Thank you again.
By the way, i get argument type mismatch (argument 3) error here..
pawn Код:
dini_IntSet(file, "Owner: %s", name);
Whole code:
pawn Код:
CMD:createaccount(playerid, params[])
{
new id, number, pin;
if(!sscanf(params, "idd", id, number, pin))
{
if(PlayerInfo[playerid][BankAccounts] <= 3)
{
format(file, sizeof(file), "bank/%d.ini", number);
if(!fexist(file))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
dini_Create(file);
dini_IntSet(file, "Pin: %d", pin);
dini_IntSet(file, "Owner: %s", name);
dini_IntSet(file, "Money:", 0);
PlayerInfo[playerid][BankAccounts] = PlayerInfo[playerid][BankAccounts]+1;
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "This account number has an owner.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "You can have 3 accounts only.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createaccount [Account Number] [Account Pin]");
}