22.11.2011, 18:11
This is a part of code...
I want if player have a minigun,.... that he get ban if isnt admin online, if admin is online that message is send to admin as warning
here is SendAdminMessage...
I want if player have a minigun,.... that he get ban if isnt admin online, if admin is online that message is send to admin as warning
pawn Код:
new string[128];
if(GetPlayerWeapon(playerid) == 36 && PlayerInfo[playerid][pAdmin] < 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
{
format(string, sizeof(string), "Player %s check him!", PlayerName(playerid));
SendAdminMessage(1,COLOR_RED, string);
}
else
{
SendClientMessage(playerid, Grey, "Ban");
BanPlayer(playerid);
}
}
}
if(GetPlayerWeapon(playerid) == 35 && PlayerInfo[playerid][pAdmin] < 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
{
format(string, sizeof(string), "Player %s check him!", PlayerName(playerid));
SendAdminMessage(1,COLOR_RED, string);
}
else
{
SendClientMessage(playerid, Grey, "Ban!");
BanPlayer(playerid);
}
}
}
if(GetPlayerWeapon(playerid) == 38 && PlayerInfo[playerid][pAdmin] < 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
{
format(string, sizeof(string), "Player %s chech him!", PlayerName(playerid));
SendAdminMessage(1,COLOR_RED, string);
}
else
{
SendClientMessage(playerid, Grey, "Ban!");
BanPlayer(playerid);
}
}
}
pawn Код:
forward SendAdminMessage(lvl, color, string[]);
public SendAdminMessage(lvl, color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= lvl)
{
SendClientMessage(i, color, string);
}
}
}
}