08.08.2015, 19:49
Hello.
So I have a mask system at my server, where players can take on a mask and then it shows Stranger_RandomNumber.
To make this able to work we made a command so admins can check who's behind the mask, the cmd is called /checkmask. However, the cmd doesnt work. It just shows "This MaskID doesn't exist!"
Can someone show me what to do to fix this?
/mask command.
stock MaskName
/checkmask command
So I have a mask system at my server, where players can take on a mask and then it shows Stranger_RandomNumber.
To make this able to work we made a command so admins can check who's behind the mask, the cmd is called /checkmask. However, the cmd doesnt work. It just shows "This MaskID doesn't exist!"
Can someone show me what to do to fix this?
/mask command.
pawn Код:
CMD:mask(playerid, params[])
{
//new name[MAX_PLAYER_NAME];
new string[128];
if (PlayerInfo[playerid][pMaskOwner] == 1)
{
if(PlayerInfo[playerid][pMask] == 0)
{
new rand = 1000 + random(8999);
MaskID[playerid] = rand;
foreach(Player, i)
{
ShowPlayerNameTagForPlayer(i, playerid, false);
}
PlayerInfo[playerid][pMask] = 1;
format(string, sizeof(string), "\n\nStranger_%d", MaskID[playerid]);
MaskLabel[playerid] = CreateDynamic3DTextLabel(string, WHITE, 0, 0, -20, 25, playerid);
Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, MaskLabel[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);
format(string, sizeof(string), "* %s has put a mask on.", RemoveUnderScore(playerid));
ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(PlayerInfo[playerid][pMask] == 1)
{
DestroyDynamic3DTextLabel(MaskLabel[playerid]);
foreach(Player, i)
{
ShowPlayerNameTagForPlayer(i, playerid, true);
}
DestroyDynamic3DTextLabel(MaskLabel[playerid]);
//MaskID[playerid] = 0;
PlayerInfo[playerid][pMask] = 0;
format(string, sizeof(string), "* %s has put their mask away.", RemoveUnderScore(playerid));
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You haven't bought a mask.");
}
return 1;
}
pawn Код:
stock MaskName(playerid)
{
new string[128];
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "Stranger %d", MaskID[playerid]);
else format(string, sizeof(string), "%s", RemoveUnderScore(playerid));
return string;
}
pawn Код:
CMD:checkmask(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 0)
{
new maski;
if(sscanf(params, "i", maski)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkmask [maskid] ( gives playername&playerid of maskid )");
{
if(maski < 1000 || maski > 9999) return SendClientMessageEx(playerid, COLOR_WHITE, "Error: MaskID can't be less than 1000 or higher than 9999.");
{
foreach(Player, i)
{
if(MaskID[i] == maski)
{
if(IsPlayerConnected(i))
{
new str[120];
format(str, sizeof(str), "MaskID %i belongs to %s (%i)", maski, RemoveUnderScore(i), i);
SendClientMessageEx(playerid, COLOR_GREEN, str);
}
else return SendClientMessageEx(playerid, COLOR_WHITE, "Error: No one was found with that MaskID.");
}
else return SendClientMessageEx(playerid, COLOR_WHITE, "Error: No one was found with that MaskID.");
}
}
}
}
else return SendClientMessageEx(playerid, COLOR_WHITE, "You are not authorized to use this command.");
return 1;
}