09.12.2010, 15:04
When i press at a ID then i want it to Force the ID to change class, but lets say i am ID_1 then i click at ID_5, Then it force me to change class instead of ID_5
pawn Код:
#include <a_samp>
new tmp[128];
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "blablabla", "Force change class", "Ok", "Cancel");
new id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"Invalid ID");
new message[128];
format(message, 128, "You clicked on player %d", clickedplayerid);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case 1:
{
switch(listitem)
{ //---------------------------------
case 0:
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) ForceClassSelection(playerid);
if(IsPlayerConnected(i)) SetPlayerHealth(playerid,0);
if(IsPlayerConnected(i)) SendClientMessage(playerid, 0xFF0000FF,"You have been forced by server admin to change class.");
}
}
//---------------------------------
}
}
}
}
return 1;
}