01.10.2011, 06:23
pawn Код:
#define DIALOG_WARN 1
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
clickedplayerid = The player you clicked.
source(not needed in this case) = of couurse the scoreboard;
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(PlayerInfo[playerid][pAdmin] >=1)
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"WarnText","Please type your warning reason here","Submit","Cancel"); // this will show you a dialog(like the one for register system,where you type in a password,but instead,you'll type here the warning reason)
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==DIALOG_WARN) // our dialog defined above at the beggining of my reply
{
if(response==0) return SendClientMessage(playerid,COLOR_RED,"Operation aborted"); // you selected cancel
if(response==1)
{
if(!strlen(inputtext)) return SendClientMessage(playerid,COLOR_RED,"You didn't type anything in the box"); // you typed no text,no warning reason
if(strlen(inputtext)) // you typed in a reason
{
new pID=clickedplayerid; // the player id you wanna give the warn
new wName[MAX_PLAYER_NAME]; // you can call this as you wish,but I though of wName( warned name)
GetPlayerName(pID,wName,sizeof(wName)); // gets the pID name
new string[120]; // the string we gonna use for the warning statement
format(string,sizeof(string),"%s(%d) has been warned by an admin.Reason:%s",wName,pID,inputtext); // the statement itself sending the warned name,his ID,and the reason
SendClientMessageToAll(COLOR_RED,string); // the message is sent to every player
}
return true;
}

