Can Someone Tell me what i did wrong? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can Someone Tell me what i did wrong? (
/showthread.php?tid=191544)
Can Someone Tell me what i did wrong? -
Fool - 19.11.2010
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;
}
Re: Can Someone Tell me what i did wrong? -
PowerPC603 - 19.11.2010
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.
Re: Can Someone Tell me what i did wrong? -
Fool - 21.11.2010
Yes, i didnt Notice, Thanks!