21.12.2010, 23:42
When i click on someone, then i get kicked and not him i clicked at -.-'
pawn Код:
#include <a_samp>
new Player[20];
new tmp[128];
//-------------------------------Dialog-----------------------------------------
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(IsPlayerAdmin(playerid))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Menu", "Kick Player", "Select", "Cancel");
new id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"Invalid ID");
Player[playerid] = clickedplayerid;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
//List of commands--------------------------------------------------------------
if(dialogid == 1)
{
if(!response)return SendClientMessage(playerid, 0xFF0C29FF,"You have cancelled.");
{
if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Kick Player", "Type in the kick reason", "Kick Player", "Cancel");
}
}
//Kick Player-------------------------------------------------------------------
if(dialogid == 2)
{
if(!response)return SendClientMessage(playerid, 0xFF0C29FF,"You have cancelled.");
{
format (string, sizeof(string), "{Admin Kick} %s(%d) %s", name, playerid, inputtext); //ClickedPlayerName, ClickedPlaterID, inputtext
SendClientMessageToAll(0x0080A1FF, string);
Player[playerid] = 0;
//SendClientMessage(playerid, 0xFF0C29FF,"REPLACE WITH KICK...");
Kick(Player[playerid]);
return 1;
}
}
return 1;
}