1 again
#1

i have global OOC chat
Quote:

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;
}

how to create enable/disable ooc chat for rcon admin and toggle ooc chat for player

please!
Reply
#2

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;
}
If you wanna do for a specific player you could use an array

Код:
new ooc[MAX_PLAYERS];
OnPlayerConnect
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;
}
Reply
#3

Quote:
Originally Posted by Flamehaze7
Посмотреть сообщение
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;
}
If you wanna do for a specific player you could use an array

Код:
new ooc[MAX_PLAYERS];
OnPlayerConnect
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;
}
this line is error
Quote:

public OnPlayerConnect(playerid)
{
ooc[playerid] = 1;
return 1;
}

this problem
Quote:

D:\Server\filterscripts\RP_Commands.pwn(2 : error 028: invalid subscript (not an array or too many subscripts): "ooc"
D:\Server\filterscripts\RP_Commands.pwn(2 : warning 215: expression has no effect
D:\Server\filterscripts\RP_Commands.pwn(2 : error 001: expected token: ";", but found "]"
D:\Server\filterscripts\RP_Commands.pwn(2 : error 029: invalid expression, assumed zero
D:\Server\filterscripts\RP_Commands.pwn(2 : fatal error 107: too many error messages on one line

Reply
#4

Quote:
Originally Posted by Imbalo
Посмотреть сообщение
this line is error

this problem
just call the array in a different way

ooc[MAX_PLAYERS]; can become oocplayer[MAX_PLAYERS];
obviously change the array name in every part of the script

the ooc[ID] and ooc[playerid]
Reply
#5

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 код:
new boolOOC_status true;
CMD:toggleooc(playerid)
{
    if(
OOC_status)
    {
        
OOC_status false;
        
SendClientMessage(playeridCOLOR_WHITE"{0000CD}[SERVER]: {FFFFFF}OOC chat disabled.");
    }
    else
    {
        
OOC_status true;
        
SendClientMessage(playeridCOLOR_WHITE"{0000CD}[SERVER]: {FFFFFF}OOC chat enabled.");
    }
    return 
1;
}
CMD:o(playeridparams[])
{
    if(!
OOC_status) return SendClientMessage(playeridCOLOR_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(stringsizeof string"(( %s says: %s ))"GetPlayerNameEx(playerid), msg);
    
SendClientMessageToAll(COLOR_WHITEstring);
    return 
1;
}
CMD:ooc(playeridparams[]) return cmd_ooc(playeridparams); 
Reply
#6

Quote:
Originally Posted by Logic_
Посмотреть сообщение
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 код:
new boolOOC_status true;
CMD:toggleooc(playerid)
{
    if(
OOC_status)
    {
        
OOC_status false;
        
SendClientMessage(playeridCOLOR_WHITE"{0000CD}[SERVER]: {FFFFFF}OOC chat disabled.");
    }
    else
    {
        
OOC_status true;
        
SendClientMessage(playeridCOLOR_WHITE"{0000CD}[SERVER]: {FFFFFF}OOC chat enabled.");
    }
    return 
1;
}
CMD:o(playeridparams[])
{
    if(!
OOC_status) return SendClientMessage(playeridCOLOR_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(stringsizeof string"(( %s says: %s ))"GetPlayerNameEx(playerid), msg);
    
SendClientMessageToAll(COLOR_WHITEstring);
    return 
1;
}
CMD:ooc(playeridparams[]) return cmd_ooc(playeridparams); 
How about /toggleooc for admins ?, so when admin / toggleooc all OOC chat enabled/disabled
Reply
#7

please help me!!
Reply
#8

First, you need to know the adminship variable in your script the most popular is: pInfo[playerid][pAdmin];
or you can even choose it for an rcon admin with: IsPlayerAdmin(playerid)
then use an " if " statement to check the admin level of player.
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
        { 
Reply
#9

i makes rcon admins
Reply
#10

Then put
Код:
if (!IsPlayerAdmin (playerid) return SendClientMessage (playerid, COLOR, "You are not authorized to use this command!);
Under command toggleooc...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)