#1

Can you guys se what i do wrong here?

Код:
../gamemodes/OnPlayerCommandZCMD.pwn(3681) : warning 209: function "cmd_unbanip" should return a value
../gamemodes/OnPlayerCommandZCMD.pwn(3682) : error 010: invalid function or declaration
../gamemodes/OnPlayerCommandZCMD.pwn(3686) : error 010: invalid function or declaration

pawn Код:
}
CMD:unbanip(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /unbanip [ip]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot unban yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    {
            format(string,sizeof(string),"unbanip %s",tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmWrn: %s has unbanned IP %s", sendername,tmp);
            AdministratorMessage(COLOR_LIGHTRED,string,1);
            BanLog(string);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#2

Can you tell me the 3681 3682 3686 lines?
Reply
#3

pawn Код:
}
CMD:unbanip(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /unbanip [ip]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot unban yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    {
            format(string,sizeof(string),"unbanip %s",tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmWrn: %s has unbanned IP %s", sendername,tmp);
            AdministratorMessage(COLOR_LIGHTRED,string,1);
            BanLog(string);
        }
    line 3681 }
     line 3682else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    line 3686 return 1;
}
Reply
#4

you have uneeded }

pawn Код:
}
CMD:unbanip(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /unbanip [ip]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot unban yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    {
            format(string,sizeof(string),"unbanip %s",tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmWrn: %s has unbanned IP %s", sendername,tmp);
            AdministratorMessage(COLOR_LIGHTRED,string,1);
            BanLog(string);
    }
    else
    {
             SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
you have uneeded }

pawn Код:
}
CMD:unbanip(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /unbanip [ip]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot unban yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    {
            format(string,sizeof(string),"unbanip %s",tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmWrn: %s has unbanned IP %s", sendername,tmp);
            AdministratorMessage(COLOR_LIGHTRED,string,1);
            BanLog(string);
    }
    else
    {
             SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
I get this.
Код:
../gamemodes/OnPlayerCommandZCMD.pwn(3681) : error 029: invalid expression, assumed zero
Reply
#6

pawn Код:
CMD:unbanip(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /unbanip [ip]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot unban yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    if (IsPlayerAdmin(playerid))
    {
            format(string,sizeof(string),"unbanip %s",tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmWrn: %s has unbanned IP %s", sendername,tmp);
            AdministratorMessage(COLOR_LIGHTRED,string,1);
            BanLog(string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
The problem is that you return a value on if (!IsPlayerConnected(targetid)) how can be different? Replace anyways if (IsPlayerAdmin(playerid)) with your admin varables if you got an admin system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)