30.06.2012, 18:19
Hey, I have attempted at making a help chat for new players to ask questions that anyone can answer, however, no-one except ID 0 can actually see the chat. Here is my code:
/n(ewbie)
tognewbie
nmute / nunmute
Helper level to name stock
Muting and toggling variables:
So yeah, only ID 0 can see it, any ideas why?
/n(ewbie)
pawn Код:
command(n, playerid, params[])
{
new text[128];
if(noff == 1) return SendClientMessage(playerid, 0x66666666, "The newbie chat is currently disabled, please use /assistance.");
if(nmuted[playerid] == 1) return SendClientMessage(playerid, 0x66666666, "You are muted from /n.");
if(ntoggled[playerid] == 0) return SendClientMessage(playerid, 0x66666666, "You cannot talk in /n if you have it toggled.");
if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0x66666666, "Usage: /n [Message]");
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(ntoggled[playerid] == 0)
{
return 1;
}
else
{
new string[128];
format(string, sizeof(string), "%s, %s: %s", HelperLevelToName(playerid), RemoveUnderScore(playerid), text);
SendClientMessage(i, 0x00FF0000, string);
return 1;
}
}
return 1;
}
pawn Код:
command(tognewbie, playerid, params[])
{
if(ntoggled[playerid] == 0)
{
ntoggled[playerid] = 1;
SendClientMessage(playerid, 0x66666666, "You have toggled newbie chat ofn, it will now display for you.");
return 1;
}
else if(ntoggled[playerid] == 1)
{
ntoggled[playerid] = 0;
SendClientMessage(playerid, 0x66666666, "You have toggled newbie chat on, it will no longer display for you.");
return 1;
}
return 1;
}
pawn Код:
command(nmute, playerid, params[])
{
if(PVar[playerid][helperlevel] > 1)
{
new id;
if(!sscanf(params, "u", id))
{
new str[128];
format(str, sizeof(str), "%s (ID %d) has muted you from the newbie chat.", RemoveUnderScore(playerid), playerid);
SendClientMessage(id, 0xCC000000, str);
nmuted[id] = 1;
format(str, sizeof(str), "You have muted %s (ID %d) from the newbie chat.", RemoveUnderScore(id), id);
SendClientMessage(playerid, 0xCC000000, str);
format(str, sizeof(str), "%s (ID %d) has muted %s (ID %d) from the newbie chat.", RemoveUnderScore(playerid), playerid, RemoveUnderScore(id), id);
SendMessageToAdmins(str);
return 1;
}
else return SendClientMessage(playerid, 0x66666666, "Usage: /nmute [ID]");
}
else
{
SendClientMessage(playerid, 0x66666666, "You are not authorised to use that command.");
return 1;
}
}
command(nunmute, playerid, params[])
{
if(PVar[playerid][helperlevel] > 1)
{
new id;
if(!sscanf(params, "u", id))
{
new str[128];
format(str, sizeof(str), "%s (ID %d) has unmuted you from the newbie chat.", RemoveUnderScore(playerid), playerid);
SendClientMessage(id, 0xCC000000, str);
nmuted[id] = 0;
format(str, sizeof(str), "You have unmuted %s (ID %d) from the newbie chat.", RemoveUnderScore(id), id);
SendClientMessage(id, 0xCC000000, str);
format(str, sizeof(str), "%s (ID %d) has unmuted %s (ID %d) from the newbie chat.", RemoveUnderScore(playerid), playerid, RemoveUnderScore(id), id);
SendMessageToAdmins(str);
return 1;
}
else return SendClientMessage(playerid, 0x66666666, "Usage: /nunmute [ID]");
}
else
{
SendClientMessage(playerid, 0x66666666, "You are not authorised to use that command.");
return 1;
}
}
pawn Код:
stock HelperLevelToName(playerid)
{
new helper[128];
switch(PVar[playerid][helperlevel])
{
case 0:
{
helper = "Newbie";
}
case 1:
{
helper = "Helper";
}
case 2:
{
helper = "Helper Mod";
}
case 3:
{
helper = "Admin";
}
}
return helper;
}
pawn Код:
new ntoggled[MAX_PLAYERS] = 1;
new nmuted[MAX_PLAYERS] = 0;
new noff = 0;