I'm need chat admin. -
Userpwon - 14.09.2012
Hello, the function of admin:
GetPVarInt > Level
in CMD:command( playerid, params[ ] )
thanks you.
Re: I'm need chat admin. -
Camacorn - 14.09.2012
pawn Код:
CMD:a(playerid, params[])
{
if(GetPVarInt < Level) return ErrorMessage(playerid);
{
new message[91];
if(sscanf(params, "s[90]", message)) return SendClientMessage( playerid, white, "USAGE: /a [message]");
if(strlen(params)>90) return SendClientMessage(playerid, red, "Invalid length. The length must be between 1 and 90 characters.");
new string[128]=0;
foreach (Player, i)
{
if(PlayerInfo[i][pAdmin] != 0) { format(string,sizeof(string),"[Admin Chat] {FFFFFF}%s{FF0000}:{FFFFFF} %s", GetPName(playerid), message); SendClientMessage(i, red, string); }
}
}
return 1;
}
Re: I'm need chat admin. -
Drake1994 - 14.09.2012
pawn Код:
CMD:command( playerid, params[ ] )
{
if( GetPVarInt( playerid, "Level" ) < 1 )
return SendClientMessage(playerid, 0xFFFFFFFF, "Only admins!");
if(isnull( params ))
return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /command [text]");
new
i = -1,
message[148 + MAX_PLAYER_NAME + 14 + 1]
;
GetPlayerName(playerid, message, MAX_PLAYER_NAME);
format(message, sizeof(message), "[AdminChat] %s: %s", message, params);
for( ;++i < MAX_PLAYERS; )
{
if( IsPlayerConnected( i ) && ( GetPVarInt( i , "Level" ) > 1) )
{
SendClientMessage( i, 0xFFFFFFFF, params );
}
}
return true;
}
Re: I'm need chat admin. -
_Khaled_ - 14.09.2012
First add stock for admin chat..
pawn Код:
stock SendMessageToAdmins(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt > Level)
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
CMD:a(playerid,params[])
{
#pragma unused params
//new pname[MAX_PLAYER_NAME]; //Your playername stock..
new string[128];
if(GetPVarInt > Level)
{
if(!strlen(params)) return SendClientMessage(playerid,COLOR_ERROR,"Usage: /ac (Message)");
//GetPlayerName(playerid, pname, sizeof(pname)); //Your player name stock..
format(string,sizeof(string), "[ADMIN MESSAGE] %s(%d): %s",pname, playerid, params);
SendMessageToAdmins(COLOR_RED, string);
return 1;
}
}
EDITED: to fit with your admin level defining
Re: I'm need chat admin. -
Userpwon - 14.09.2012
Quote:
Originally Posted by _Khaled_
First add stock for admin chat..
pawn Код:
stock SendMessageToAdmins(color, const string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPVarInt > Level) { SendClientMessage(i, color, string); } } } return 1; }
CMD:a(playerid,params[]) { #pragma unused params //new pname[MAX_PLAYER_NAME]; //Your playername stock.. new string[128]; if(GetPVarInt > Level) { if(!strlen(params)) return SendClientMessage(playerid,COLOR_ERROR,"Usage: /ac (Message)");
//GetPlayerName(playerid, pname, sizeof(pname)); //Your player name stock.. format(string,sizeof(string), "[ADMIN MESSAGE] %s(%d): %s",pname, playerid, params); SendMessageToAdmins(COLOR_RED, string); return 1; } }
EDITED: to fit with your admin level defining
|
I'm have error in stock - SendMessageToAdmins.
in line: if(GetPVarInt > Level)
Re: I'm need chat admin. -
_Khaled_ - 14.09.2012
It's YOUR admin level saving, show me your Y_INI enum or something..
also copy me the compiler error
Re: I'm need chat admin. -
Userpwon - 14.09.2012
Quote:
Originally Posted by _Khaled_
It's YOUR admin level saving, show me your Y_INI enum or something..
also copy me the compiler error
|
compiler error:error 076: syntax error in the expression, or invalid function call
LOL
i have no Y_INI, what to do?
I'm have YSI/y_ini, it okay?
Re: I'm need chat admin. -
_Khaled_ - 14.09.2012
Dunno sorry :/
I'm not familiar with anything but Y_INI..
Don't know MySQL or anything else..
show me your player saving codes.
Re: I'm need chat admin. -
Drake1994 - 14.09.2012
Quote:
Originally Posted by Drake1994
pawn Код:
CMD:command( playerid, params[ ] ) { if( GetPVarInt( playerid, "Level" ) < 1 ) return SendClientMessage(playerid, 0xFFFFFFFF, "Only admins!"); if(isnull( params )) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /command [text]"); new i = -1, message[148 + MAX_PLAYER_NAME + 14 + 1] ; GetPlayerName(playerid, message, MAX_PLAYER_NAME); format(message, sizeof(message), "[AdminChat] %s: %s", message, params); for( ;++i < MAX_PLAYERS; ) { if( IsPlayerConnected( i ) && ( GetPVarInt( i , "Level" ) > 1) ) { SendClientMessage( i, 0xFFFFFFFF, params ); } } return true; }
|
I dont know, that are you blind or not, but my code is full perfect, and working, any code here is a such of bug and made me laugh
Re: I'm need chat admin. -
Userpwon - 14.09.2012
Quote:
Originally Posted by _Khaled_
Dunno sorry :/
I'm not familiar with anything but Y_INI..
Don't know MySQL or anything else..
show me your player saving codes.
|
I'm will give you an example of a command that you know it functions.
if ( GetPVarInt( playerid, "Level" ) < 1 )
it my functions of the admin.
PHP код:
it stock, (1487) : error 076: syntax error in the expression, or invalid function call
stock SendMessageToAdmins(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt > Level)
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
it line 1487: if(GetPVarInt > Level)
How do i fix it?