/ipcheck problem [help me] -
Loudinest - 30.03.2018
When ever I type /ipcheck or the command /ban it crashes the server IP
here is my /ipcheck command and /ban command
Code:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pBanAppealer] >= 1 || PlayerInfo[playerid][pModerator] >= 1 || PlayerInfo[playerid][pSecretAdmin] >= 1)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");
if(AntiAdv(playerid, params)) return 1;
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin])
{
SendClientMessageEx(playerid, COLOR_REALRED, "You are not authorized to ban administrators.");
}
else
{
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
if(AdminDuty[giveplayerid] == 1 || PlayerInfo[playerid][pAdmin] >= 5)
{
new username[MAX_PLAYER_NAME];
GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
SetPVarInt(giveplayerid, "TempName", 0);
SetPlayerName(giveplayerid, username);
format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
Log("logs/ban.log", string);
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
ABroadCast(COLOR_LIGHTRED, string, 1);
}
ABroadCast(COLOR_LIGHTRED, string, 1);
new ip[32], hour, minute, second, day, month, year;
gettime(hour, minute, second);
getdate(year, month, day);
GetPlayerIp(giveplayerid,ip,sizeof(ip));
SendClientMessageEx(giveplayerid, COLOR_REALRED, "You're banned from Golden Roleplay. You can appeal your ban at Goldenrp.com");
SendClientMessageEx(giveplayerid, COLOR_REALRED, "-------------------- BAN REPORT --------------------");
format(string, sizeof(string), "Reason: %s", reason);
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Current Warnings: %d (3 for BAN)", PlayerInfo[giveplayerid][pWarns]);
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Staff: %s", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "IP Address: %s", ip);
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Time: %02d:%02d:%02d on %02d/%02d/%d", hour, minute, second, day, month, year);
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
SendClientMessageEx(giveplayerid, COLOR_REALRED, "It is strongly recommended that you keep this report for future reference (Press F8)");
SendClientMessageEx(giveplayerid, COLOR_REALRED, "You may appeal this ban at "WEBSITE".");
SetTimerEx("BanTimer", 2000, 0, "ds", giveplayerid, ip);
format(string, sizeof(string), "(%02d:%02d:%02d on %02d/%02d/%d) BanLogs: %s has banned %s, reason: %s",hour,minute,second, day, month, year, GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
GetPlayerIp(playerid,ip,sizeof(ip));
AddBan(ip);
PlayerInfo[playerid][pBanned] = 1;
Kick(playerid);
return 1;
}
} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
}
return 1;
}
/ipcheck command
Code:
CMD:ipcheck(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ipcheck [playerid/partofname]");
if(giveplayerid == INVALID_PLAYER_ID) return 1;
if(IsPlayerConnected(giveplayerid))
{
new playerip[32], country[64], city[64];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
GetIPCountry(playerip, country, 64);
GetIPCity(playerip, city, 64);
format(string, sizeof(string), "ID: %d - Name: %s - IP: %s - Country: %s - City: %s", giveplayerid, GetPlayerNameEx(giveplayerid), playerip, country, city);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}
I really need serious help
PS: when ever I do /ban it crashes the samp-server.exe and also I'm not playing on local host
Re: /ipcheck problem [help me] -
UFF - 30.03.2018
Code:
CMD:ipcheck(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
return SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ipcheck [playerid/partofname]");
if(giveplayerid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
if(IsPlayerConnected(giveplayerid))
{
new playerip[32], country[64], city[64];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
GetIPCountry(playerip, country, 64);
GetIPCity(playerip, city, 64);
format(string, sizeof(string), "ID: %d - Name: %s - IP: %s - Country: %s - City: %s", giveplayerid, GetPlayerNameEx(giveplayerid), playerip, country, city);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
try this...! I will check out the ban code.
Re: /ipcheck problem [help me] -
Loudinest - 30.03.2018
it says I'm not Authorized to use that command and also I'm level 5 admin so it should work
Re: /ipcheck problem [help me] -
Abagail - 30.03.2018
Problem is it checks if you're ABOVE that level, rather than below it. Also randomly spitting out code isn't helping somebody in a Scripting Help section, even if it worked. Go over why it doesn't work, and how to fix it.
Re: /ipcheck problem [help me] -
UFF - 30.03.2018
Code:
if(PlayerInfo[playerid][pAdmin] >= 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
To
Code:
if(PlayerInfo[playerid][pAdmin] < 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
Admins from level 1 - 5 can use this command.
Re: /ipcheck problem [help me] -
MadeMan - 30.03.2018
Do you have the logs folder inside scriptfiles?