CMD:offlineban(playerid, params[], help) { if(help) { SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Command /offlineban: {FFFFFF}Bans a player who is offline."); } else { if(pInfo[playerid][pLogged] == 0) return 0; if(pInfo[playerid][pAdminLevel] >= 4) { new string[158], reason[120], targetname[24], filestring[79]; if(sscanf(params, "s[24]s[120]", targetname, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Syntax: {FFFFFF}/offlineban [fullname] [reason]"); GetPlayerName(playerid, sendername, sizeof(sendername)); // Here in this line is where I throw the error. format(filestring, sizeof(filestring), "/ZMA/Users/%s.ini", targetname); if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Error: {FFFFFF}Player doesn't exist."); else { new INI:File = INI_Open(filestring)); INI_SetTag(File, "data"); INI_RemoveEntry(File, "Banned"); INI_WriteInt(File, "Banned", 1); INI_Close(File); format(string, sizeof(string),"{FF6347}Admin %s banned the offline player %s, reason: %s", sendername, targetname, reason); SendClientMessageToAll(COLOR_WHITE, string); } } else { SendClientMessage(playerid, COLOR_WHITE, ""MinimumAdmin1""); return 1; } } return 1; }
D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3427) : error 017: undefined symbol "sendername" D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3427) : error 017: undefined symbol "sendername" D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3427) : error 029: invalid expression, assumed zero D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3427) : fatal error 107: too many error messages on one line
new sendername[MAX_PLAYER_NAME];
CMD:offlineban(playerid, params[], help)
{
if(help)
{
SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Command /offlineban: {FFFFFF}Bans a player who is offline.");
}
else
{
if(pInfo[playerid][pLogged] == 0) return 0;
if(pInfo[playerid][pAdminLevel] >= 4)
{
new string[158], reason[120], targetname[MAX_PLAYER_NAME], filestring[79], sendername[MAX_PLAYER_NAME]; // sendername needed to be declared
if(sscanf(params, "s[24]s[120]", targetname, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Syntax: {FFFFFF}/offlineban [fullname] [reason]");
GetPlayerName(playerid, sendername, sizeof(sendername)); // Here in this line is where I throw the error.
format(filestring, sizeof(filestring), "/ZMA/Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}Error: {FFFFFF}Player doesn't exist.");
else
{
new INI:File = INI_Open(filestring));
INI_SetTag(File, "data");
INI_RemoveEntry(File, "Banned");
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
format(string, sizeof(string),"{FF6347}Admin %s banned the offline player %s, reason: %s", sendername, targetname, reason);
SendClientMessageToAll(COLOR_WHITE, string);
}
} else return SendClientMessage(playerid, COLOR_WHITE, MinimumAdmin1); // {} + return SendClientMessage
}
return 1;
}
PHP код:
{} can be avoided if you have only one line after the condition. You can return SendClientMessage because SendClientMessage return 1 if the player is connected and when you type a command, you are connected to the server so it will return 1. |
D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3440) : error 001: expected token: "-string end-", but found "-identifier-" D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3440) : error 017: undefined symbol "MinimumAdmin1" D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3440) : warning 215: expression has no effect D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3440) : error 001: expected token: ";", but found ")" D:\Program Files\PROYECTO GM ZOMBIE PROXIMAMENTE - ASISTENTES JANSELK THORO DEAD MAU SREMMURD\Zombie Nightmare\gamemodes\zmazombie.pwn(3440) : fatal error 107: too many error messages on one line
Line 3432: new INI:File = INI_Open(filestring)); Line 3440: } else return SendClientMessage(playerid, COLOR_WHITE, ""MinimumAdmin1""); return 1; } // {} + return SendClientMessage