Can Someone Tell me what i did wrong?
#1

Will i have a Problem with my /AFK command I can show what happend
I Get this Warning When i hit complie: C:\Users\me\Desktop\New folder2\gamemodes\CR.pwn(7521) : warning 209: function "dcmd_afk" should return a value

Well here is the command

Код:
dcmd_afk(playerid,params[])
{
#pragma unused params
	if(PlayerInfo[playerid][Jailed] || PlayerInfo[playerid][IsTazed] || PlayerInfo[playerid][IsCuffed] || PlayerInfo[playerid][Kidnapped] || PlayerInfo[playerid][IsTied])
		return SendClientMessage(playerid,red,"You can't do that at this time!");
	if(PlayerInfo[playerid][IsAfk] == 0)
	{
	    new
            string[128];
        GetPlayerPos(playerid,aX[playerid],aY[playerid],aZ[playerid]); SetPlayerPos(playerid,aX[playerid],aY[playerid],aZ[playerid]+400);
        TogglePlayerControllable(playerid,0);
		AfkColor[playerid] = GetPlayerColor(playerid);
        SetPlayerColor(playerid,COLOR_DEAD);
        format(string,sizeof(string),"%s(%d) is now in state Away From Keyboard (/AFK)",PlayerName(playerid),playerid);
        SendClientMessageToAll(COLOR_WHITE,string);
        SendClientMessage(playerid,red,"To get away from AFK state, use /afkoff");
        PlayerInfo[playerid][IsAfk] = 1;
    }
    else SendClientMessage(playerid,red,"You are already AFK, use /afkoff to set it off");
    return;
}
Reply
#2

Like the warning says: you forgot to return a value at the last line (return; ).

You should place "return 0" or "return 1".
Best to use "return 1", or you get a message in the chatbox from the server: "Server: unknown command" while playing.
Reply
#3

Yes, i didnt Notice, Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)