Just tried
Код:
C:\Users\matthew\Desktop\New Generation LS;RP 2012 Server\filterscripts\afk.pwn(42) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\matthew\Desktop\New Generation LS;RP 2012 Server\filterscripts\afk.pwn(56) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Код:
#include <a_samp>
new AFK[MAX_PLAYERS];
new Text3D:AFKL[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
AFK[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
Delete3DTextLabel(AFKL[playerid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
if (strcmp("/afklist", cmdtext, true) == 0)
{
SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(AFK[i] == 1)
{
new name[128];
GetPlayerName(i,name,128);
format(string, 256, "%s", name);
SendClientMessage(playerid, 0xFFFF00FF, string);
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/imafk", true))
{
new string[128], name[MAX_PLAYER_NAME];
if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
GetPlayerName(playerid, name, sizeof name);
AFK[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
format(string, sizeof string, "%s is now AFK!", name);
SendClientMessageToAll(0xAFAFAFAA, string);
AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
return 1;
}
if(!strcmp(cmdtext, "/back", true))
{
new string[128], name[MAX_PLAYER_NAME];
if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
GetPlayerName(playerid, name, sizeof name);
AFK[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, 0x33AA33AA, "You are back!");
format(string, sizeof string, "%s is back!", name);
SendClientMessageToAll(0xAFAFAFAA, string);
Delete3DTextLabel(AFKL[playerid]);
return 1;
}
return 0;
}