Ich habe bei einen AFKscript einen Fehler gemacht aber ich weiß nicht welchen
ich starte das spiel und ich bin am Anfang sofort AFK
Hier der Script
// Copyright (c) Meischnei 2011
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Meischnei AFK Modus Version: 1.1");
print("--------------------------------------\n");
SetTimer("AFKTimer",1800,1);
for(new i = 0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i)) OnPlayerConnect(i);
return 1;
}
enum Afkinfo
{
inafk,
afkcount,
x,
y,
z,
vw
}
new namep[MAX_PLAYER_NAME];
new string[128];
new AFK[MAX_PLAYERS][Afkinfo];
forward AFKTimer();
forward StartFK(id);
public StartFK(id)
{
AFK[id][afkcount] = 0;
return 1;
}
public OnPlayerConnect(playerid)
{
AFK[playerid][afkcount] =10;
SetPlayerVirtualWorld(playerid,0);
TogglePlayerControllable(playerid,1);
AFK[playerid][inafk] = 0;
SetTimerEx("StartFK",20000,0,"%i",playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(AFK[playerid][inafk] == 1)
{
SetPlayerVirtualWorld(playerid,0);
TogglePlayerControllable(playerid,1);
AFK[playerid][inafk] = 0;
GetPlayerName(playerid, namep, sizeof(namep));
if (strcmp(namep,"[AFK]_",true,6) == 0 )
{
strdel(namep,0,6);
SetPlayerName(playerid,namep);
}
AFK[playerid][afkcount] =10;
SetTimerEx("StartFK",20000,0,"%i",playerid);
format(string, sizeof(string), "%s ist vom AFK zurück!", namep);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
if(strcmp(cmdtext, "/afk", true) == 0)
{
if(AFK[playerid][inafk] == 0)
{
SetPlayerVirtualWorld(playerid,playerid+1);
TogglePlayerControllable(playerid,0);
AFK[playerid][inafk] = 1;
GetPlayerName(playerid, namep, sizeof(namep));
format(string, sizeof(string), "%s is ist nun AFK!", namep);
strins(namep,"[AFK]_",0, MAX_PLAYER_NAME );
SetPlayerName(playerid,namep);
SendClientMessageToAll(COLOR_GREEN, string);
}
return 1;
}
if(strcmp(cmdtext, "/listafk", true) == 0)
{
new bool:none = false;
string = "There is not any player in afk at this time.";
for(new i = 0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
GetPlayerName(i,namep,MAX_PLAYER_NAME);
if(!none)
{
format(string,128,"Player im AFK modus: %s [ID:%d],",namep,i);
none = true;
} else format(string,256,"%s %s [ID:%d]",string,namep,i);
}
return SendClientMessage(playerid,COLOR_WHITE,string);
}
return 0;
}
public AFKTimer()
{
for(new i = 0; i < 200; i++)
{
if(IsPlayerConnected(i))
{
if(AFK[i][inafk]) return GameTextForPlayer(i,"~r~AFK MODE /back",2000,1), TogglePlayerControllable(i,0);
if(!AFK[i][inafk])
{
if(AFK[i][afkcount] > 0 && AFK[i][afkcount] != 10) AFK[i][afkcount]--;
if(AFK[i][afkcount] <= 0 && AFK[i][afkcount] != 10)
{
SetPlayerVirtualWorld(i,i+1);
TogglePlayerControllable(i,0);
AFK[i][inafk] = 1;
GetPlayerName(i, namep, sizeof(namep));
format(string, sizeof(string), "%s ist nun AFK!", namep);
strins(namep,"[AFK]_",0, MAX_PLAYER_NAME );
SetPlayerName(i,namep);
SendClientMessageToAll(COLOR_GREEN, string);
}
}
}
}
return 1;
}
public OnPlayerText(playerid,text[])
{
if(AFK[playerid][inafk]) return OnPlayerCommandText(playerid,"/byEps");
return 1;
}
public OnPlayerUpdate(playerid) if(AFK[playerid][afkcount] < 9) AFK[playerid][afkcount]++;
public OnFilterScriptExit() for(new i = 0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && AFK[i][inafk]) OnPlayerCommandText(i,"/donotedit");
Könnt ihr mir helfen
MFGPiet_Meischnei