Help in AFK System
#1

Hello Guys!
I want to make AFK(Away From Keyboard) System but if player have wanted level then he dont go AFK this system I want but when I compile it it shows these errors
Код:
C:\Users\XGamerZ\Desktop\afk.pwn(15) : error 010: invalid function or declaration
C:\Users\XGamerZ\Desktop\afk.pwn(21) : error 028: invalid subscript (not an array or too many subscripts): "playerid"
C:\Users\XGamerZ\Desktop\afk.pwn(21) : warning 215: expression has no effect
C:\Users\XGamerZ\Desktop\afk.pwn(21) : error 001: expected token: ";", but found "]"
C:\Users\XGamerZ\Desktop\afk.pwn(21) : error 029: invalid expression, assumed zero
C:\Users\XGamerZ\Desktop\afk.pwn(21) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Please help me!
I will be very thankful to you
Here is my AFK System
Код:
#include a_samp
#include zcmd

#define COLOR_BLUE 0x375FFFFF
#define COLOR_WHITE 0xFFFFFFAA



#define afkdialog 1165

new afk[MAX_PLAYERS];

new Text3D:label[MAX_PLAYERS];
new wantedlevel;
wantedlevel = GetPlayerWantedLevel(playerid);

CMD:afk(playerid,params[])
{
    if(afk[playerid] == 0)
    {
       if(playerid[wantedlevel] > 0)
       {
    	 ShowPlayerDialog(playerid, afkdialog, DIALOG_STYLE_INPUT, "{FF0000}Reason:", "{FFFF00}Please Type Reason of going AFK Below.", "Done", "Cancel");
       }
       else
       {
          SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[ERROR]{FFFFFF} You cannot go AFK(Away From Keyboard) with wanted level.");
       }
     else
     {
         SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[ERROR]{FFFFFF} You are already AFK(Away From Keyboard).");
     }

     return 1;
}
CMD:back(playerid,params[])
{
    if(afk[playerid] == 0) return SendClientMessage(playerid,COLOR_WHITE, "{FF0000}[ERROR]{FFFFFF}  You are not AFK(Away From Keyboard).");
    new string[128],pname[32];
    GetPlayerName(playerid,pname,sizeof(pname));
	format(string,sizeof(string),"%s {FFFF00}Is now Back to the keyboard.",pname);
	SendClientMessageToAll(COLOR_WHITE, string);
	Delete3DTextLabel(label[playerid]);
	TogglePlayerControllable(playerid,1);
	afk[playerid] = 0;
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == afkdialog) {
		if(response == 0) {
			new string[128],pname[32];
			GetPlayerName(playerid,pname,sizeof(pname));
			format(string,sizeof(string),"%s {FFFF00}Is now AFK(Away from Keyboard).",pname);
			SendClientMessageToAll(COLOR_WHITE, string);
			label[playerid] = Create3DTextLabel(" ",0xAA3333AA,30.0,40.0,50.0,15.0,0);
			Update3DTextLabelText(label[playerid], 0xAA3333AA, "AFK(Away From Keyboard)");
	        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.4);
	        SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}Type /back when you back :)");
	        TogglePlayerControllable(playerid,0);
	        afk[playerid] = 1;
	        return 1;
		}
		else if(response == 1) {
		if(!strlen(inputtext)) {
		new string[128],pname[32];
		GetPlayerName(playerid,pname,sizeof(pname));
		format(string,sizeof(string),"%s {FFFF00}Is now AFK(Away from Keyboard).",pname);
		SendClientMessageToAll(COLOR_WHITE, string);
		label[playerid] = Create3DTextLabel(" ",0xAA3333AA,30.0,40.0,50.0,15.0,0);
		Update3DTextLabelText(label[playerid], 0xAA3333AA, "AFK(Away From Keyboard)");
	    Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.4);
	    SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}Type /back when you back :)");
	    TogglePlayerControllable(playerid,0);
	    afk[playerid] = 1;
        } else if(strlen(inputtext))
		     {
	         new string[128],pname[32];
	         GetPlayerName(playerid,pname,sizeof(pname));
	         format(string,sizeof(string),"%s {FFFF00}Is now Away from Keyboard. {FF0000}|-Reason: %s -|",pname,inputtext);
	         SendClientMessageToAll(COLOR_WHITE, string);
             label[playerid] = Create3DTextLabel(" ",0xAA3333AA,30.0,40.0,50.0,15.0,0);
             format(string,sizeof(string),"AFK.|-Reason: %s -|",inputtext);
             Update3DTextLabelText(label[playerid], 0xAA3333AA, string);
             Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.4);
             SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}Type /back when you back :)");
             TogglePlayerControllable(playerid,0);
             afk[playerid] = 1;
             return 1;
		 }
	  }
	}
	return 1;
}
public OnPlayerConnect(playerid)
{
 afk[playerid] = 0;
 return 1;
}
public OnPlayerDisconnect(playerid)
{
 afk[playerid] = 0;
 return 1;
}
Reply


Messages In This Thread
Help in AFK System - by LegendAbdullah - 26.04.2018, 07:27
Re: Help in AFK System - by AdamsLT - 26.04.2018, 07:43
Re: Help in AFK System - by LegendAbdullah - 26.04.2018, 07:49
Re: Help in AFK System - by LegendAbdullah - 26.04.2018, 07:54
Re: Help in AFK System - by AdamsLT - 26.04.2018, 08:02
Re: Help in AFK System - by LegendAbdullah - 26.04.2018, 08:56
Re: Help in AFK System - by CodeStyle175 - 26.04.2018, 09:15
Re: Help in AFK System - by LegendAbdullah - 26.04.2018, 09:36
Re: Help in AFK System - by Stev - 26.04.2018, 10:04
Re: Help in AFK System - by UFF - 26.04.2018, 10:18

Forum Jump:


Users browsing this thread: 1 Guest(s)