SA-MP Forums Archive
How to? - 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: How to? (/showthread.php?tid=356531)



How to? - Chris1337 - 04.07.2012

I Have Textdraw for a bank system , but i use like

pawn Код:
new Hi[MAX_PLAYERS];

//When I Show The Main TD

Hi[playerid] = 1;
But i want to like
Show : Put The Amount to deposit

The action is like when a player types 2390154210 or in this case a %d and that td is showing deposit that into account


Re: How to? - [KHK]Khalid - 04.07.2012

Didn't understand you well enough. But I guess you're gonna need Format to format a string and insert the "amount" you want into it then use TextDrawSetString to add the formatted string into your created textdraw. Ah if it's the first time you work with textdraws, then I advise you to read this tutorial.


Respuesta: How to? - Chris1337 - 04.07.2012

but i mean like Checking the stuff that he wrote

I mean :

Instead of doing /deposit (amount)


Appear A TD saying :

Enter The Amount To Deposit

and he enters Ex: 8428 so 8428 will deposit to his account


Re: How to? - vassilis - 04.07.2012

I can't understand what you are trying to say re-edit it and try to explain it better.


Respuesta: How to? - Chris1337 - 05.07.2012

i tried this :

pawn Код:
if(strcmp(cmd, "2", true) == 0)
    {
        if(sbi[playerid] == 1)
        {
            new newtext[254];
            format(newtext, sizeof(newtext), "~y~%s~n~~n~~y~-~w~Welcome To The Business Bank~n~~y~1.~w~Deposit~n~~y~2.~w~Withdraw~n~~y~",dini_Get(file, "Name"));
            TextDrawSetString(bmenu, newtext);
            TextDrawShowForPlayer(playerid, bmenu);
            bbank[playerid] = 1;
        }
        return 0;
    }
    if(bbank[playerid] == 1 && IsNumeric(text))
    {
        print("Depositing Into Business Acount");
        return 0;
    }
And it does print that , but when i try this

pawn Код:
if(strcmp(cmd, "2", true) == 0)
    {
        if(sbi[playerid] == 1)
        {
            new newtext[254];
            format(newtext, sizeof(newtext), "~y~%s~n~~n~~y~-~w~Welcome To The Business Bank~n~~y~1.~w~Deposit~n~~y~2.~w~Withdraw~n~~y~",dini_Get(file, "Name"));
            TextDrawSetString(bmenu, newtext);
            TextDrawShowForPlayer(playerid, bmenu);
            bbank[playerid] = 1;
        }
        return 0;
    }
    if(bbank[playerid] == 1 && IsNumeric(text))
    {
        GivePlayerMoney(playerid, -text);
        return 0;
    }
pawn Код:
C:\Users\Usuario\Desktop\Projects\AChr1s\filterscripts\BizNonmysql.pwn(556) : error 035: argument type mismatch (argument 2)



Re: How to? - ViniBorn - 05.07.2012

pawn Код:
GivePlayerMoney(playerid, -strval(text));



Respuesta: How to? - Chris1337 - 05.07.2012

Done and repped , but can you explain me why is that the strval , you know for learn more gracias


Re: How to? - FUNExtreme - 05.07.2012

Strval turns a string into an integer... Everything you input in the chat is a string which is why you can use strcmp, it compares strings. But giveplayermoney only accepts integers, this is why you convert it with strval