A lil help.
#1

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.
Код:
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.
Script:-
Код:
#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;
}
Reply
#2

You have that variable commented..

Код:
// new id;
becomes
Код:
new id;
Reply
#3

Thanks but there is a lil more problem lol, When I type /eventbankhost, it says that only administrators can use this cmd even when I am on RCON, and when I try to deposit or withdraw any amount it doesn't deposit or withdraw...
Help needed.
Reply
#4

Show us the code for the command.
Reply
#5

Quote:
Originally Posted by Hammad123
Посмотреть сообщение
Thanks but there is a lil more problem lol, When I type /eventbankhost, it says that only administrators can use this cmd even when I am on RCON, and when I try to deposit or withdraw any amount it doesn't deposit or withdraw...
Help needed.
This
PHP код:
CMD:eventbankhost(playeridparams[])
{
    if(
PlayerData[playerid][playerLevel] >= || playerid != EventData[EventHostID] || IsPlayerAdmin(playerid)) 
    {
        new 
id,string[126];
        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!");
        
format(stringsizeof(string), "[EVENT]: Administrator %s has made %s the event bank host."GetName(playerid), GetName(id));
        
SendClientMessageToAll(-1string);
        
EventData[EventHostID] = id;
    }
    else
    {
        
SendClientMessage(playerid, -1,"ERROR: Only administrators can use this command!");
    }
return 
1;

Reply
#6

Quote:
Originally Posted by Exhibit
Посмотреть сообщение
Show us the code for the command.
Код:
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;
}
Reply
#7

Quote:
Originally Posted by RxErT
Посмотреть сообщение
This
PHP код:
CMD:eventbankhost(playeridparams[])
{
    if(
PlayerData[playerid][playerLevel] >= || playerid != EventData[EventHostID] || IsPlayerAdmin(playerid)) 
    {
        new 
id,string[126];
        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!");
        
format(stringsizeof(string), "[EVENT]: Administrator %s has made %s the event bank host."GetName(playerid), GetName(id));
        
SendClientMessageToAll(-1string);
        
EventData[EventHostID] = id;
    }
    else
    {
        
SendClientMessage(playerid, -1,"ERROR: Only administrators can use this command!");
    }
return 
1;

Received errors.
Reply
#8

Quote:
Originally Posted by Hammad123
Посмотреть сообщение
Received errors.
You've got all permission to provide the errors you got.
Reply
#9

Quote:
Originally Posted by RxErT
Посмотреть сообщение
You've got all permission to provide the errors you got.
Код:
D:\New folder\filterscripts\eventbank.pwn(120) : error 017: undefined symbol "PlayerData"
D:\New folder\filterscripts\eventbank.pwn(120) : warning 215: expression has no effect
D:\New folder\filterscripts\eventbank.pwn(120) : error 001: expected token: ";", but found "]"
D:\New folder\filterscripts\eventbank.pwn(120) : error 029: invalid expression, assumed zero
D:\New folder\filterscripts\eventbank.pwn(120) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)