Should return a value?
#1

pawn Код:
dcmd_kick(playerid,params[]){
    if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOUR_RED, "You need to be admin to use this command");
            new Index;
            new tmp[256];  tmp  = strtok(params,Index);
            new tmp2[256]; tmp2 = strtok(params,Index);
            if(!strlen(params)) return
            SendClientMessage(playerid, COLOUR_RED, "Usage: /kick [ID] [Reason]") &&
            SendClientMessage(playerid, COLOUR_RED, "NOTE: You don't have to put the reason if you don't want to");
            new player1;
            new string[128];
            new playername[MAX_PLAYER_NAME];
            new adminname [MAX_PLAYER_NAME];
            player1 = strval(tmp);

            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][AdminLevel]))
             {
                GetPlayerName(player1, playername, sizeof(playername));
                GetPlayerName(playerid, adminname, sizeof(adminname));
                if(!strlen(tmp2))
                {
                format(string,sizeof(string),"%s got kicked by Administrator %s . Reason:No reason given",playername,adminname);
                SendClientMessageToAll(COLOUR_ORANGE,string);
                return Kick(player1);
                }
                else
                {
                format(string,sizeof(string),"%s got kicked by Administrator %s . Reason: %s.",playername,adminname,params[2]);
                SendClientMessageToAll(COLOUR_ORANGE,string);
                return Kick(player1);}}}

Код:
C:\DOCUME~1\gazdeki\Desktop\FLHP0~1.3B\FILTER~1\MEANAD~2.PWN(317) : warning 209: function "dcmd_kick" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
How to fix that
Reply
#2

What about returning an value? lol.
Reply
#3

That just give me another warn (unreachable code) +
return Kick(player1);


That isnt returning value?
Reply
#4

pawn Код:
dcmd_kick(playerid,params[])
{
    if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOUR_RED, "You need to be admin to use this command");
    else
    {
            new Index;
            new tmp[256];  tmp  = strtok(params,Index);
            new tmp2[256]; tmp2 = strtok(params,Index);
            if(!strlen(params)) return
            SendClientMessage(playerid, COLOUR_RED, "Usage: /kick [ID] [Reason]") &&
            SendClientMessage(playerid, COLOUR_RED, "NOTE: You don't have to put the reason if you don't want to");
            new player1;
            new string[128];
            new playername[MAX_PLAYER_NAME];
            new adminname [MAX_PLAYER_NAME];
            player1 = strval(tmp);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][AdminLevel]))
            {
                GetPlayerName(player1, playername, sizeof(playername));
                GetPlayerName(playerid, adminname, sizeof(adminname));
                if(!strlen(tmp2))
                {
                    format(string,sizeof(string),"%s got kicked by Administrator %s . Reason:No reason given",playername,adminname);
                    SendClientMessageToAll(COLOUR_ORANGE,string);
                    Kick(player1);
                }
                else
                {
                    format(string,sizeof(string),"%s got kicked by Administrator %s . Reason: %s.",playername,adminname,params[2]);
                    SendClientMessageToAll(COLOUR_ORANGE,string);
                    Kick(player1);
                }
            }
        }
    }
    return 1;
}
The 'Kick' function does not return any specified value.
Reply
#5

@ Retardedwolf
it gives me an error for return 1; line
Код:
C:\DOCUME~1\gazdeki\Desktop\FLHP0~1.3B\FILTER~1\MEANAD~2.PWN(314) : warning 209: function "dcmd_kick" should return a value
C:\DOCUME~1\gazdeki\Desktop\FLHP0~1.3B\FILTER~1\MEANAD~2.PWN(315) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
EDIT: : : : : never mind, fixed
Reply
#6

Remove the '{' above return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)