28.05.2018, 22:57
So yeah I am new to the scripting and shits, please help me I get a lot of errors and I dont know how to fix them.
Script:-
Код:
D:\New folder\filterscripts\eventbank.pwn(123) : warning 225: unreachable code D:\New folder\filterscripts\eventbank.pwn(123) : error 017: undefined symbol "id" D:\New folder\filterscripts\eventbank.pwn(124) : error 017: undefined symbol "id" D:\New folder\filterscripts\eventbank.pwn(125) : error 017: undefined symbol "id" D:\New folder\filterscripts\eventbank.pwn(128) : error 017: undefined symbol "id" D:\New folder\filterscripts\eventbank.pwn(131) : error 017: undefined symbol "id" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
// Request for Hammad123
#define DIALOG_WITHDRAW 4201
#define DIALOG_DEPOSIT 4202
#if !defined isnull
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
enum E_EVENT_DATA
{
EventHostID,
EventBankBalance
};
new EventData[E_EVENT_DATA];
public OnGameModeInit()
{
ResetEventVariables();
}
public OnPlayerDisconnect(playerid, reason)
{
if(playerid == EventData[EventHostID])
{
EventData[EventHostID] = -1;
new string[126];
format(string, sizeof(string), "[EVENT]: {F2F853}Host %s has left the server. There is no Event Host now.", GetName(playerid));
SendClientMessageToAll(-1, string);
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_WITHDRAW:
{
if(response)
{
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, -1, "ERROR: Please input a number!");
if(EventData[EventBankBalance] < 1) return SendClientMessage(playerid, -1, "ERROR: There is no balance left in the Event Bank.");
if(strval(inputtext) > EventData[EventBankBalance]) return SendClientMessage(playerid, -1, "ERROR: The Event Bank does not have enough funds!");
EventData[EventBankBalance] = EventData[EventBankBalance] - strval(inputtext);
GivePlayerMoney(playerid, strval(inputtext));
new string[126];
format(string, sizeof(string), "[EVENT]: {F2F853}Host %s has withdrawn %d from the bank.", GetName(playerid), EventData[EventBankBalance]);
SendClientMessageToAll(-1, string);
}
}
case DIALOG_DEPOSIT:
{
if(response)
{
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, -1, "ERROR: Please input a number!");
if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "Error: You do not have enough money!");
EventData[EventBankBalance] = EventData[EventBankBalance] + strval(inputtext);
new string[126];
format(string, sizeof(string), "[EVENT]: %s has deposited $%d to the Event Bank.", GetName(playerid), strval(inputtext));
SendClientMessageToAll(-1, string);
}
}
}
return 1;
}
// Commands
CMD:eventbank(playerid, params[])
{
if(isnull(params))
return SendClientMessage(playerid, -1, "USAGE: /eventbank [HOST|WITHDRAW|DEPOSIT|BALANCE]");
if(!strcmp(params, "host"))
{
if(EventData[EventHostID] == -1)
return SendClientMessage(playerid, -1, "ERROR: No host has been assigned!");
new string[126];
format(string, sizeof(string), "[EVENT]: The host is %s", GetName(EventData[EventHostID]));
SendClientMessage(playerid, -1, string);
return 1;
}
else if(!strcmp(params, "withdraw"))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i != EventData[EventHostID])
return SendClientMessage(playerid, -1, "ERROR: Only the event hoster can access this command.");
ShowPlayerDialog(playerid, DIALOG_WITHDRAW ,DIALOG_STYLE_INPUT, "Enter value to withdraw", "Please enter a value to withdraw", "Withdraw", "Exit");
}
}
else if(!strcmp(params, "deposit"))
{
if(GetPlayerMoney(playerid) < 1)
return SendClientMessage(playerid, -1, "ERROR: You do not have enough cash!");
ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Enter value to deposit", "Please enter a value to deposit", "Deposit", "Exit");
}
else if(!strcmp(params, "balance"))
{
new string[126];
format(string, sizeof(string), "[EVENT]: There is $%d in the bank.", EventData[EventBankBalance]);
SendClientMessage(playerid, -1, string);
}
return 1;
}
CMD:eventbankhost(playerid, params[])
{
// if(PlayerData[playerid][playerLevel] >= 5 || playerid != EventData[EventHostID])
return SendClientMessage(playerid, -1, "ERROR: Only administrators can use this command!");
// new id;
if(sscanf(params, "r", id)) return SendClientMessage(playerid, -1, "USAGE: /eventbankhost <id/name>");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "ERROR: The user does not exist!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "The player is not connected!");
EventData[EventHostID] = id;
new string[126];
format(string, sizeof(string), "[EVENT]: Administrator %s has made %s the event bank host.", GetName(playerid), GetName(id));
SendClientMessageToAll(-1, string);
return 1;
}
// Custom Functions
ResetEventVariables()
{
EventData[EventHostID] = -1;
EventData[EventBankBalance] = 0;
}
GetName(playerid)
{
new szName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szName, sizeof(szName));
return szName;
}
IsNumeric(string[])
{
new j = strlen(string);
if(j == 0) return 0;
for(new i = 0; i < j; i++)
{
if(string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}


