#1

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <streamer>
#define COLOUR_GREEN           0x33AA33AA
#define COLOUR_RED             0xAA3333AA
#define COLOUR_YELLOW          0xFFFF00AA
#define COLOUR_LIGHTBLUE       0x33CCFFAA
#define COLOUR_ORANGE          0xFF9900AA
#define COLOUR_BLACK           0x00000000
enum pInfo
{
   BankMoney,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Bank_Dialog/Users/%s.ini"
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}



main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 if(strcmp("/bank", cmdtext, true, 10) == 0)
  {
    SetPlayerPos(playerid, 2154.3754882813, 1631.17578125, 9935.88671875);
    SendClientMessage(playerid, COLOUR_YELLOW, "Welcome to the bank");
    ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Bank","Deposit\r\nWithdraw\r\nBalance","Cancel", "Confirm");
    ResetPlayerWeapons(playerid);
    return 1;
  }
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
if(dialogid == 4)
{
if(!response){
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
}
switch(listitem)
            {
                case 0:
                {
                    ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Deposit","Enter the amount below:","deposit","Cancel");
                }
                case 1:
                {
                    ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Withdraw","Enter the amount below:","withdraw","Cancel");
                }
                case 2:
                {
                new string[128];
format(string, sizeof(string), "You have on you bank account %d money", PlayerInfo[playerid][BankMoney]);
SendClientMessage(playerid, COLOUR_YELLOW, string);
                }
               

            }

        }

if(dialogid == 5)
{
    new string[128];
    new playermoney = GetPlayerMoney(playerid);
    new money = strval(inputtext);
    new cash = PlayerInfo[playerid][BankMoney] += money;
    if(!response)
    {
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    }
    if(strlen(inputtext) > 0)
    {
        if(playermoney >= money)
        {
            GivePlayerMoney(playerid, -money);
            format(string, sizeof(string), "You deposited %d cash in your bank account. now you have %d in you bank account", money, cash);
            SendClientMessage(playerid, COLOUR_YELLOW, string);
            dini_Create(file);
            dini_IntSet(file, "Bank Money",cash);
        }
        else
        {
        PlayerInfo[playerid][BankMoney] -= money;
            SendClientMessage(playerid, COLOUR_RED, "You do not have this amount of money!!!");
        }

    }
    else
    {
        SendClientMessage(playerid, COLOUR_RED, "You did not type in any number!!!!!!");
    }
}
if(dialogid == 6)
{
    new string[128];
    new playermoney = GetPlayerMoney(playerid);
    new money = strval(inputtext);
    new cash = PlayerInfo[playerid][BankMoney] -= money;
    if(!response)
    {
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    }
    if(strlen(inputtext) > 0)
    {
        if(PlayerInfo[playerid][BankMoney] >= money)
        {
            dini_IntSet(file, "BankMoney",cash);
            GivePlayerMoney(playerid, money);
            format(string, sizeof(string), "You withdraw %d from your bank account. now you have %d in you bank account", money, cash);
            SendClientMessage(playerid, COLOUR_GREEN, string);
        }
        else
        {
        PlayerInfo[playerid][BankMoney] += money;
            SendClientMessage(playerid, COLOUR_RED, "You do not have this amount of money on your bank account!!!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOUR_RED, "You did not type in any number!!!!");
    }
}
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{

return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
when i withdraw/deposit if i dont have the money it tells me then i dont have the money but still deposit or withdraw from my bank account.... another thing is that i cant deposit or withdraw the exact amount that i have... only less... but it still says in balance that the money is deposited... when i withdraw a huge number like 1667186718 it does -$$$$ i dont know why but in the bank i give me alot of money and on player it do like -1869186194... this is a problem because the player can juse /kill and the money will reset but the bank money wont... plz help!!!(there are no errors only warnings)
sorry for my bad english!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)