07.07.2010, 10:58
So here is one of mine new Function
Its call SetPlayerBlind(playerid,toggle);
Very useful for punishing some server rule ignorer xD
Example
Its call SetPlayerBlind(playerid,toggle);
Very useful for punishing some server rule ignorer xD
pawn Код:
new Text:Blind;
new PlayerIsBlind[MAX_PLAYERS]; >> OnPlayerConnect should be set to 0
forward CreateTextDrawForAll(); >> put it in OnGameModeInit();
forward SetPlayerBlind(playerid,toggle);
public CreateTextDrawForAll()
{
Blind = TextDrawCreate(0.0,0.0,"00000"); //For /blind cmd
TextDrawUseBox(Blind,1);
TextDrawBoxColor(Blind,0x000000FF);
TextDrawTextSize(Blind,950,950);
TextDrawFont(Blind,3);
TextDrawLetterSize(Blind,5,100);
TextDrawColor(Blind,0x000000FF);
}
public SetPlayerBlind(playerid,toggle)
{
if(toggle == 1)
{
TextDrawShowForPlayer(playerid,Blind);
PlayerIsBlind[playerid] = 1;
}
else if (toggle == 0)
{
TextDrawHideForPlayer(playerid,Blind);
PlayerIsBlind[playerid] = 0;
}
}
pawn Код:
if(strcmp(cmd, "/blind", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /blind [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerIsBlind[playa])
{
SetPlayerBlind(playa,0);
format(string, sizeof(string), "AdmCmd: %s is Unblinded by %s",giveplayer ,sendername);
SendClientMessage(playa,COLOR_LIGHTBLUE,"* You can now see, you was unblinded by Admin.");
}
else
{
SetPlayerBlind(playa,1);
SendClientMessage(playa,COLOR_LIGHTBLUE,"* You are now blind, you was blinded by Admin.");
format(string, sizeof(string), "AdmCmd: %s is Blinded by %s",giveplayer ,sendername);
}
SendMessageToAdmin(COLOR_LIGHTRED,string,1);
}
}
}
else
{
SendFalseText(playerid,"You cannot use this command.");
}
}
return 1;
}

