03.07.2012, 15:43
Heres my code:
Errors:
pawn Код:
/*////////////////////////////////
Bank system v1.0 by stormchaser206
////////////////////////////////*/
#define FILTERSCRIPT
#include <a_samp>
#include <streamer>
new RobbingBank[MAX_PLAYERS];
new RobTimer[MAX_PLAYERS];
new CashInBank[MAX_PLAYERS];
new Deposits[MAX_PLAYERS];
new Withdraws[MAX_PLAYERS];
//Checkpoint
new Checkpoint;
//Dialogs
#define DIALOG_ROBBANK 7830
#define DIALOG_UBANK 6561
#define DIALOG_WITHDRAW 25394
#define DIALOG_WITHDRAW2 22845
#define DIALOG_DEPOSIT 18138
#define DIALOG_DEPOSIT2 16588
#define DIALOG_BINFO 89345
//Defines
#define MAX_ROB_MONEY 200000
//Forwards
forward RobCountdown(playerid);
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n===========================================");
print(" Bank System v1.0 by stormchaser206 loaded!");
print("===========================================\n");
Checkpoint = CreateDynamicCP(822.6652, 3.2782, 1004.1797, 5.0);
return 1;
}
public OnFilterScriptExit()
{
print("\n=============================================");
print(" Bank System v1.0 by stormchaser206 unloaded!");
print("=============================================\n");
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Change SetGameModeText to your gamemodes name
SetGameModeText("ChangeMe");
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)
{
KillTimer("RobCountdown");
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("/robbank", cmdtext, true, 8) == 0)
{
if(IsPlayerInDynamicCP(playerid, Checkpoint))
{
new string[50];
format(string, sizeof(string),"Finish robbery in:\n%d seconds", RobTimer[playerid]);
RobbingBank[playerid] = 1;
ShowPlayerDialog(playerid, DIALOG_ROBBANK, "Robbing Bank", string, "OK");
SetTimer("RobCountdown", 1000, 1);
}
else SendClientMessage(playerid, 0xFF000FF, "ERROR: You must be in the bank checkpoint to use this command.");
return 1;
}
if (strcmp("/usebank", cmdtext, true, 8) == 0)
{
if(IsPlayerInDynamicCP(playerid, Checkpoint))
{
ShowPlayerDialog(playerid, DIALOG_UBANK, DIALOG_STYLE_LIST, "Bank", "Withdraw Money\nDeposit Money\nAccount Info", "OK", "Cancel");
}
else SendClientMessage(playerid, 0xFF000FF, "ERROR: You must be in the bank checkpoint to use this command.");
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == Checkpoint)
{
GameTextForPlayer(playerid,"TYPE /USEBANK TO USE BANK~n~TYPE /ROBBANK TO ROB BANK", 4000, 4);
}
return 1;
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
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)
{
if(RobbingBank[playerid] == 1)
{
if(RobTimer[playerid] == 0)
{
KillTimer("RobCountdown");
RobTimer[playerid] = 0;
new pName[MAX_PLAYER_NAME];
new string[100];
GetPlayerName(playerid, pName, sizeof(pName));
ShowPlayerDialog(playerid, DIALOG_ROBBANK, DIALOG_STYLE_MSGBOX, "Bank Robbery complete", "You have successfully robbed the bank", "OK");
new rand = random(60000);
GivePlayerMoney(playerid, rand);
format(string, sizeof(string),"-| You have robbed $%d from the bank! |-", rand);
SendClientMessage(playerid, 0x00FFFFFF, string);
format(string, sizeof(string),"-| %s(%d) has robbed $%d from the bank! |-", pName, playerid, rand);
SendClientMessageToAll(0x00FFFFFF, string);
}
}
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 OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_UBANK)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(CashInBank[playerid] > 0)
{
ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw Money", "Please enter the amount you would like to withdraw.", "OK", "Back");
}
else SendClientMessage(playerid, 0xFF0000FF, "ERROR: You have no money to take out.");
}
case 1:
{
if(GetPlayerMoney(playerid) > 0)
{
ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit Money", "Please enter the amount you want to deposit.", "OK", "Back");
}
else SendClientMessage(playerid, 0xFF0000FF, "ERROR: You have no money to put in.");
}
case 2:
{
new string[100];
format(string, sizeof(string),"--Bank Info--\nCash In Bank: $%d\nDeposits: %d\nWithdraws: %d", CashInBank[playerid], Deposits[playerid], Withdraws[playerid]);
ShowPlayerDialog(playerid, DIALOG_BINFO, DIALOG_STYLE_MSGBOX, string,
}
}
}
else
{
//The player has pressed "OK".
switch(listitem)
{
case 0:
{
//Selected Item: "Withdraw Money"
}
case 1:
{
//Selected Item: "Deposit Money"
}
case 2:
{
//Selected Item: "Account Info"
}
}
}
}
if(dialogid == DIALOG_WITHDRAW)
{
if(response)
{
if(CashInBank[playerid] >= inputtext)
{
new string[100];
GivePlayerMoney(playerid, inputtext);
CashInBank[playerid] -= inputtext;
format(string, sizeof(string),"-| You have taken $%d out of your bank. |-", inputtext);
SendClientMessage(playerid, 0xFFFF00FF, string);
Withdraws[playerid]++;
}
else ShowPlayerDialog(playerid, DIALOG_WITHDRAW2, DIALOG_STYLE_INPUT, "Invalid Withdraw Amount", "{FF0000}You have entered an invalid amount. Reason: You don't have the money in your bank.\n\n\t\tPlease enter an amount you would like to withdraw.", "OK", "Cancel");
}
else
{
ShowPlayerDialog(playerid, DIALOG_UBANK, DIALOG_STYLE_LIST, "Bank", "Withdraw Money\nDeposit Money\nAccount Info", "OK", "Cancel");
}
}
if(dialogid == DIALOG_WITHDRAW2)
{
if(response)
{
if(CashInBank[playerid] >= inputtext)
{
new string[100];
GivePlayerMoney(playerid, inputtext);
CashInBank[playerid] -= inputtext;
format(string, sizeof(string),"-| You have taken $%d out of your bank. |-", inputtext);
SendClientMessage(playerid, 0xFFFF00FF, string);
Withdraws[playerid]++;
}
else ShowPlayerDialog(playerid, DIALOG_WITHDRAW2, DIALOG_STYLE_INPUT, "Invalid Withdraw Amount", "{FF0000}You have entered an invalid amount. Reason: You don't have the money in your bank.\n\n\t\tPlease enter an amount you would like to withdraw.", "OK", "Cancel");
}
else
{
//The player has pressed "Cancel".
}
}
if(dialogid == DIALOG_DEPOSIT)
{
if(response)
{
if(GetPlayerMoney(playerid) >= inputtext)
{
GivePlayerMoney(playerid, -inputtext);
new string[100];
format(string, sizeof(string),"-| You have put $%d in your bank. |-", inputtext);
SendClientMessage(playerid, 0xFFFF00FF, string);
CashInBank[playerid] += inputtext;
Deposits[playerid]++;
}
else ShowPlayerDialog(playerid, DIALOG_DEPOSIT2, DIALOG_STYLE_INPUT, "Invalid Deposit Amount", "{FF0000}You have entered an invalid amount. Reason: You do not have this money to put in.\n\n\t\tPlease enter an amount to withdraw.", "OK", "Back");
}
else
{
ShowPlayerDialog(playerid, DIALOG_UBANK, DIALOG_STYLE_LIST, "Bank", "Withdraw Money\nDeposit Money\nAccount Info", "OK", "Cancel");
}
}
if(dialogid == DIALOG_DEPOSIT2)
{
if(response)
{
if(GetPlayerMoney(playerid) >= inputtext)
{
GivePlayerMoney(playerid, -inputtext)
new string[100];
format(string, sizeof(string),"-| You have put $%d in your bank. |-", inputtext);
SendClientMessage(playerid, 0xFFFF00FF, string);
CashInBank[playerid] += inputtext;
Deposits[playerid]++;
}
else ShowPlayerDialog(playerid, DIALOG_DEPOSIT2, DIALOG_STYLE_INPUT, "Invalid Deposit Amount", "{FF0000}You have entered an invalid amount. Reason: You do not have this money to put in.\n\n\t\tPlease enter an amount to withdraw.", "OK", "Back");
}
else
{
//The player has pressed "Back".
}
}
if(dialogid == DIALOG_BINFO)
{
//It just hides the dialog, so nothing goes here.
}
return 0;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public RobCountdown(playerid)
{
RobTimer[playerid]--;
new string[50];
format(string, sizeof(string),"Finish robbery in:\n%d seconds", RobTimer[playerid]);
RobbingBank[playerid] = 1;
ShowPlayerDialog(playerid, DIALOG_ROBBANK, "Robbing Bank", string, "OK");
return 1;
}
Код:
C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(3) : warning 216: nested comment C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(92) : error 035: argument type mismatch (argument 1) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(130) : error 035: argument type mismatch (argument 3) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(259) : error 035: argument type mismatch (argument 1) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(264) : warning 202: number of arguments does not match definition C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(324 -- 325) : error 029: invalid expression, assumed zero C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(328) : warning 217: loose indentation C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(328) : error 029: invalid expression, assumed zero C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(349) : warning 217: loose indentation C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(353) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(356) : error 035: argument type mismatch (argument 2) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(357) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(374) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(377) : error 035: argument type mismatch (argument 2) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(378) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(395) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(397) : error 035: argument type mismatch (argument 2) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(401) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(416) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(418) : error 035: argument type mismatch (argument 2) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(419) : error 001: expected token: ";", but found "new" C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(422) : error 033: array must be indexed (variable "inputtext") C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(440) : warning 217: loose indentation C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(440) : error 029: invalid expression, assumed zero C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(440) : error 004: function "OnPlayerClickPlayer" is not implemented C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(445) : warning 225: unreachable code C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(445) : error 029: invalid expression, assumed zero C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(445) : error 004: function "RobCountdown" is not implemented C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(451) : error 035: argument type mismatch (argument 3) C:\Users\Keegan\Desktop\filterscripts\BankSystem.pwn(454) : error 030: compound statement not closed at the end of file (started at line 298) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 24 Errors.