Bank PIN System
#1

Hello guys I am scripting a RP gamemode from scratch to learn PAWN deeper and more effectively, I went through lots of things and solved them myself/with help of guys in here. But I am stuck in Bank PIN system, here is its' codes:


pawn Код:
if(dialogid == 46)
    {
    if(response)
    {
    new string[256];
    if(!strval(inputtext))
    {
    SendClientMessage(playerid,-1,"{FF0000}[HATA]: {FFFFFF}Lьtfen numara giriniz.");
    ShowPlayerDialog(playerid,46,DIALOG_STYLE_INPUT,"{FFAAEE}[T-RPG] - {FF0000}Banka Sistemi","Gцrьnьşe gцre ilk kez bankamıza geldiniz, lьtfen bir PIN kaydediniz.","Tamam","İptal");
    }
    if(strval(inputtext) == 0)
    {
    SendClientMessage(playerid,-1,"{FF0000}[HATA]: {FFFFFF}Yanlış bir değer girdiniz.");
    SendClientMessage(playerid,-1,"{FF0000}(( {00FF00}[BİLGİLENDİRME]: {FFFFFF}Şifre harfden oluşamaz. Lьtfen RAKAM giriniz. {FF0000}))");
    }
    if(strlen(inputtext) >= 5 || strlen(inputtext) == 0)
    {
    SendClientMessage(playerid,-1,"{FF0000}[HATA]: {FFFFFF}Şifreniz en az 1, en зok 4 numara olabilir.");
    ShowPlayerDialog(playerid,46,DIALOG_STYLE_INPUT,"{FFAAEE}[T-RPG] - {FF0000}Banka Sistemi","Gцrьnьşe gцre ilk kez bankamıza geldiniz, lьtfen bir PIN kaydediniz.","Tamam","İptal");
    }
    else
    {
    new sifre = strval(inputtext);
    PlayerInfo[playerid][pBanka] = 1;
    PlayerInfo[playerid][pPIN] = sifre;
    format(string,sizeof(string),"{00FF00}[BİLGİLENDİRME]: {FFFFFF}Şifreniz başarıyla %i yapılmıştır.",sifre);
    SendClientMessage(playerid,-1,string);
    ShowPlayerDialog(playerid,45,DIALOG_STYLE_INPUT,"{FFAAEE}[T-RPG] - {FF0000}Banka Sistemi","Lьtfen alttaki kutucuğa kaydettiğiniz banka şifresini giriniz.","Tamam","İptal");
    }
    }
    }
Whole system works fine, just when player types, for example "asd", it must say "You must put an integer value" but it says "Your password is succesfully set to 0" and you can log-in to your bank acc even by typing "agkjsahgjaksh" because such password also matches to 0. Any help is appreciated, thanks !
Reply
#2

Haven't worked with those stuff for a long time, but I think the functions IsNumeric works fine (https://sampwiki.blast.hk/wiki/Useful_Functions#IsNumeric) That will check if the player typed numbers.
Reply
#3

Quote:
Originally Posted by Kimossab
Посмотреть сообщение
Haven't worked with those stuff for a long time, but I think the functions IsNumeric works fine (https://sampwiki.blast.hk/wiki/Useful_Functions#IsNumeric) That will check if the player typed numbers.
Thanks for the help, I will test it now and will edit the result
Reply
#4

You can either use isNumeric or Sscanf.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)