CMD:afk(playerid, params[])
{
new
Float:LastX[ MAX_PLAYERS ],
Float:LastY[ MAX_PLAYERS ],
Float:LastZ[ MAX_PLAYERS ];
GetPlayerPos(playerid, LastX[ playerid ], LastY[ playerid ], LastZ[ playerid ]);
SetPlayerPos(playerid,2324.419921,-1145.568359,1050.710083);
SetPlayerInterior(playerid, 12);
SendClientMessage(playerid, COLOR_YELLOW, "You are now AFK, type /back to move again!");
TogglePlayerControllable(playerid,0);
label[playerid] = Create3DTextLabel("AFK",yellow,30.0,40.0,50.0,40.0,0); //====This Is Line 312
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is now Away from the keyboard!", name);
SendClientMessageToAll(COLOR_YELLOW, string3);
}
C:\Users\Danyal\dmgamemode.pwn(312) : error 017: undefined symbol "label"
C:\Users\Danyal\dmgamemode.pwn(312) : warning 215: expression has no effect
C:\Users\Danyal\dmgamemode.pwn(312) : error 001: expected token: ";", but found "]"
C:\Users\Danyal\dmgamemode.pwn(312) : error 029: invalid expression, assumed zero
C:\Users\Danyal\dmgamemode.pwn(312) : fatal error 107: too many error messages on one line
new Text3D:label
CMD:afk(playerid, params[])
{
new
Float:LastX[ MAX_PLAYERS ],
Float:LastY[ MAX_PLAYERS ],
Float:LastZ[ MAX_PLAYERS ];
GetPlayerPos(playerid, LastX[ playerid ], LastY[ playerid ], LastZ[ playerid ]);
SetPlayerPos(playerid,2324.419921,-1145.568359,1050.710083);
SetPlayerInterior(playerid, 12);
SendClientMessage(playerid, COLOR_YELLOW, "You are now AFK, type /back to move again!");
TogglePlayerControllable(playerid,0);
label[playerid] = Create3DTextLabel("AFK",COLOR_YELLOW,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is now Away from the keyboard!", name);
SendClientMessageToAll(COLOR_YELLOW, string3);
}
CMD:back(playerid, params[])
{
new
Float:LastX[ MAX_PLAYERS ],
Float:LastY[ MAX_PLAYERS ],
Float:LastZ[ MAX_PLAYERS ];
SetPlayerPos(playerid, LastX[ playerid ], LastY[ playerid ], LastZ[ playerid ]);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, COLOR_YELLOW, "You are now back!");
TogglePlayerControllable(playerid,1);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is now Back!", name);
SendClientMessageToAll(COLOR_YELLOW, string3);
Delete3DTextLabel(Text3D:label[playerid]);
return 1;
}
|
above problem solved but here is new one
pawn Код:
and another thing when i type /back it doesnt teleport me to my place where i typed afk. it teleports me in air and player goes through ground |
new storePos[MAX_PLAYERS][3];
LastY = storePos[playerid][0];
LastX = storePos[playerid][1];
LastZ = storePos[playerid][2];
new
Float:LastX[ MAX_PLAYERS ],
Float:LastY[ MAX_PLAYERS ],
Float:LastZ[ MAX_PLAYERS ];
SetPlayerPos(playerid, LastX[ playerid ], LastY[ playerid ], LastZ[ playerid ]);
SetPlayerPos(playerid, storePos[playerid][0], storePos[playerid][1], storePos[playerid][2]);
new storePos[3];
LastY = storePos[1];//====line 6
LastX = storePos[0];
LastZ = storePos[2];
error 010: invalid function or declaration
|
pawn Код:
pawn Код:
|
new storePos[MAX_PLAYERS][3];
LastY = storePos[playerid][0]; //==== line 6
LastX = storePos[playerid][1];
LastZ = storePos[playerid][2];
error 010: invalid function or declaration
#include <a_samp>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#pragma tabsize 0
//Colors
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
enum Player
{
AFKstatus
}
new PlayerInfo[MAX_PLAYERS][Player];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Simple AFK/BRB System By Sufyan \n Loading.....\nLoaded Successfully !");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
dcmd_afk(playerid, params[])
{
#pragma unused params
new string[256];
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Your status is already AFK/BRB!");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "<!> {00C0FF}%s{FFFFFF}[{33AA33}ID:{F81414}%d{FFFFFF}]{00C0FF} is away from keyboard!", pname,playerid);
SendClientMessageToAll(COLOR_WHITE, string);
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
PlayerInfo[playerid][AFKstatus] = 1;
return 1;
}
return 0;
}
dcmd_brb(playerid, params[])
{
#pragma unused params
new string[256];
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Your status is already AFK/BRB!");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "<!> {00C0FF}%s{FFFFFF}[{33AA33}ID:{F81414}%d{FFFFFF}]{00C0FF} will be right back!", pname,playerid);
SendClientMessageToAll(COLOR_WHITE, string);
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
PlayerInfo[playerid][AFKstatus] = 1;
return 1;
}
return 0;
}
dcmd_back(playerid, params[])
{
#pragma unused params
new string [256];
if (PlayerInfo[playerid][AFKstatus] == 0)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Your status is already BACK!");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "<!> {00C0FF}%s{FFFFFF}[{33AA33}ID:{F81414}%d{FFFFFF}]{00C0FF} has returned!", pname,playerid);
SendClientMessageToAll(COLOR_WHITE, string);
TogglePlayerControllable(playerid,1);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) - 50);
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
return 0;
}
dcmd_afkplayers( playerid, params[ ] )
{
#pragma unused params
new count = 0;
new name[MAX_PLAYER_NAME];
new string[128];
//
SendClientMessage(playerid, COLOR_WHITE, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "AFK Players List:");
SendClientMessage(playerid, COLOR_WHITE, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][AFKstatus] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, 256, "%s{FFFFFF}[{6EF83C}ID:{F81414}%d{FFFFFF}]", name,i );
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
count++;
}
}
}
if (count == 0)
{
SendClientMessage(playerid, COLOR_RED, "There Are No Players in the AFK/BRB List");
}
SendClientMessage(playerid, COLOR_WHITE, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
public OnPlayerText(playerid, text[])
{
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You need to be /back to use the chatbox.");
return 0;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
return 1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(afk,3,cmdtext);
dcmd(brb,3,cmdtext);
dcmd(back,4,cmdtext);
dcmd(afkplayers,10,cmdtext);
return 0;
}