CMD:O(OC)(playerid, params[]) { new msg[128]; new string[100]; if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]"); format(string,sizeof(string),"(( %s says: %s )) ", GetPlayerNameEx(playerid), msg); SendClientMessageToAll(COLOR_WHITE, string); return 1; } |
new ooc = 1;
CMD:disableallooc(playerid,params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,urcolor,"You're not admin!"); if(ooc == 0) return SendClientMessage(playerid,urcolor,"The ooc chat is already disabled!"); ooc = 0; SendClientMessage(playerid,urcolor,"You disabled the ooc chat!"); return 1; }
CMD:O(OC)(playerid, params[]) { if(ooc == 0) return SendClientMessage(playerid,urcolor,"The ooc chat is not enabled); new msg[128]; new string[100]; if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]"); format(string,sizeof(string),"(( %s says: %s )) ", GetPlayerNameEx(playerid), msg); SendClientMessageToAll(COLOR_WHITE, string); return 1; }
new ooc[MAX_PLAYERS];
ooc[playerid] = 1;
CMD: disableooc(playerid,params[]) { new ID; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,urcolor,"You're not admin!"); if(ooc[ID] == 0) return SendClientMessage(playerid,urcolor,"This player doesn't have the ooc chat enabled!"); if(sscanf(params,"d",ID)) return SendClientMessage(playerid,urcolor,"Usage /disableooc [id]"); ooc[ID] = 0; return 1; }
CMD:O(OC)(playerid, params[]) { new msg[128]; new string[100]; if(ooc[playerid] == 0) return SendClientMessage(playerid,urcolor,"Your ooc chat has been disabled!"); if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]"); format(string,sizeof(string),"(( %s says: %s )) ", GetPlayerNameEx(playerid), msg); SendClientMessageToAll(COLOR_WHITE, string); return 1; }
To do that for everyone you just use a global variable
Код:
new ooc = 1; Код:
CMD:disableallooc(playerid,params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,urcolor,"You're not admin!"); if(ooc == 0) return SendClientMessage(playerid,urcolor,"The ooc chat is already disabled!"); ooc = 0; SendClientMessage(playerid,urcolor,"You disabled the ooc chat!"); return 1; } Код:
CMD:O(OC)(playerid, params[]) { if(ooc == 0) return SendClientMessage(playerid,urcolor,"The ooc chat is not enabled); new msg[128]; new string[100]; if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]"); format(string,sizeof(string),"(( %s says: %s )) ", GetPlayerNameEx(playerid), msg); SendClientMessageToAll(COLOR_WHITE, string); return 1; } Код:
new ooc[MAX_PLAYERS]; It enables the ooc for the player when he connects Код:
ooc[playerid] = 1; Код:
CMD: disableooc(playerid,params[]) { new ID; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,urcolor,"You're not admin!"); if(ooc[ID] == 0) return SendClientMessage(playerid,urcolor,"This player doesn't have the ooc chat enabled!"); if(sscanf(params,"d",ID)) return SendClientMessage(playerid,urcolor,"Usage /disableooc [id]"); ooc[ID] = 0; return 1; } Код:
CMD:O(OC)(playerid, params[]) { new msg[128]; new string[100]; if(ooc[playerid] == 0) return SendClientMessage(playerid,urcolor,"Your ooc chat has been disabled!"); if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]"); format(string,sizeof(string),"(( %s says: %s )) ", GetPlayerNameEx(playerid), msg); SendClientMessageToAll(COLOR_WHITE, string); return 1; } |
public OnPlayerConnect(playerid) { ooc[playerid] = 1; return 1; } |
D:\Server\filterscripts\RP_Commands.pwn(2 ![]() D:\Server\filterscripts\RP_Commands.pwn(2 ![]() D:\Server\filterscripts\RP_Commands.pwn(2 ![]() D:\Server\filterscripts\RP_Commands.pwn(2 ![]() D:\Server\filterscripts\RP_Commands.pwn(2 ![]() |
new bool: OOC_status = true;
CMD:toggleooc(playerid)
{
if(OOC_status)
{
OOC_status = false;
SendClientMessage(playerid, COLOR_WHITE, "{0000CD}[SERVER]: {FFFFFF}OOC chat disabled.");
}
else
{
OOC_status = true;
SendClientMessage(playerid, COLOR_WHITE, "{0000CD}[SERVER]: {FFFFFF}OOC chat enabled.");
}
return 1;
}
CMD:o(playerid, params[])
{
if(!OOC_status) return SendClientMessage(playerid, COLOR_WHITE, "{0000CD}[SERVER]: {FFFFFF}OOC chat is disabled.");
new msg[100], string[128];
if(sscanf(params,"s[100]", msg)) return SendClientMessage(playerid, -1, "{0000CD}[SERVER]: {FFFFFF}/o [Message]");
format(string, sizeof string, "(( %s says: %s ))", GetPlayerNameEx(playerid), msg);
SendClientMessageToAll(COLOR_WHITE, string);
return 1;
}
CMD:ooc(playerid, params[]) return cmd_ooc(playerid, params);
You need to learn about Variables and Boolean.
First of all, we'll make a boolean variable called OOC_status, then we'll make a command which toggles it. And then, we'll add a line in the OOC command which will respond if the OOC is disabled. PHP код:
|
CMD:toggleooc(playerid)
{
if (pInfo[playerid][pAdmin] >= 3)
{ //Replace 3 with the number you want. OR for rcon admin.
if(IsPlayerAdmin(playerid))
{
if(OOC_status)
{
if (!IsPlayerAdmin (playerid) return SendClientMessage (playerid, COLOR, "You are not authorized to use this command!);