SA-MP Forums Archive
Bank PIN System - 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)
+--- Thread: Bank PIN System (/showthread.php?tid=520928)



Bank PIN System - Rufio - 20.06.2014

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 !


Re: Bank PIN System - Kimossab - 20.06.2014

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.


Re: Bank PIN System - Rufio - 20.06.2014

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


Re: Bank PIN System - Beckett - 20.06.2014

You can either use isNumeric or Sscanf.