Dialog not showing up
#1

Okay so i made a kick command wich shows you a dialog when you get kicked. well thats what it needs to do but it doesnt show up. What am i doing wrong?

pawn Код:
CMD:kick(playerid, params[])
{
    if(APlayerData[playerid][Admin] > 0)
    {
        new OtherPlayer, Reason[128], string4[1000], pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], Year, Month, Day, Hour, Minute, Second;
        if(sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick [playerid] [Reason]\"");
        else
        {
       
            GetPlayerName(OtherPlayer, pName, sizeof(pName));
            GetPlayerName(playerid, aName, sizeof(aName));
           
            getdate(Year, Month, Day);
            gettime(Hour, Minute, Second);
           
            format(string4, 500, "%s{FFFFFF}-------{FF9900}Kick information{FFFFFF}-------\n", string4);
            format(string4, 500, "%s{FFFFFF}Kick reason: {FF9900}%s\n",string4, Reason);
            format(string4, 500, "%s{FFFFFF}Kicked by: {FF9900}%s\n", string4, aName);
            format(string4, 500, "%s{FFFFFF}Date: {FF9900}%02d-%02d-%02d\n", string4, Day, Month, Year);
            format(string4, 500, "%s{FFFFFF}Time: {FF9900}%02d:%02d:%02d\n", string4, Hour, Minute, Second);
            format(string4, 500, "%s{FFFFFF}If you think this ban is unfair go to http://www.European-Trucking.com and make a ban appeal on forum\n", string4);
            format(string4, 500, "%s{FFFFFF}Please make a picture of this! you will need this for unbanning!\n", string4);
            format(string4, 500, "%s{FFFFFF}-----------------------------", string4);
            ShowPlayerDialog(OtherPlayer, DialogKick, DIALOG_STYLE_MSGBOX,"Notice",string4,"Close","");
            Kick(OtherPlayer);
        }
    }
    else
        SendClientMessage(playerid, 0xFF0000, "You are not admin");
    return 1;
}
Also i defined DialogKick as 5 on top of my gamemode
Also when i change
pawn Код:
ShowPlayerDialog(OtherPlayer, DialogKick, DIALOG_STYLE_MSGBOX,"Notice",string4,"Close","");
Into this
pawn Код:
ShowPlayerDialog(playerid, DialogKick, DIALOG_STYLE_MSGBOX,"Notice",string4,"Close","");
It works for the admin who kicked it. But if you want to show it to the other one it doesnt work
Reply
#2

Try this one:

pawn Код:
CMD:kick(playerid, params[])
{
    if(APlayerData[playerid][Admin] > 0)
    {
        new OtherPlayer, Reason[128], string4[1000], pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], Year, Month, Day, Hour, Minute, Second;
        if(sscanf(params, "us[128]", OtherPlayer, Reason)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick [playerid] [Reason]\"");
        if(!IsPlayerConnected(OtherPlayer)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR:The player is not connected!");
        GetPlayerName(OtherPlayer, pName, sizeof(pName));
        GetPlayerName(playerid, aName, sizeof(aName));
        getdate(Year, Month, Day);
        gettime(Hour, Minute, Second);          
        format(string4, 500, "%s{FFFFFF}-------{FF9900}Kick information{FFFFFF}-------\n", string4);
        format(string4, 500, "%s{FFFFFF}Kick reason: {FF9900}%s\n",string4, Reason);
        format(string4, 500, "%s{FFFFFF}Kicked by: {FF9900}%s\n", string4, aName);
        format(string4, 500, "%s{FFFFFF}Date: {FF9900}%02d-%02d-%02d\n", string4, Day, Month, Year);
        format(string4, 500, "%s{FFFFFF}Time: {FF9900}%02d:%02d:%02d\n", string4, Hour, Minute, Second);
        format(string4, 500, "%s{FFFFFF}If you think this ban is unfair go to http://www.European-Trucking.com and make a ban appeal on forum\n", string4);
        format(string4, 500, "%s{FFFFFF}Please make a picture of this! you will need this for unbanning!\n", string4);
        format(string4, 500, "%s{FFFFFF}-----------------------------", string4);
        ShowPlayerDialog(OtherPlayer, DialogKick, DIALOG_STYLE_MSGBOX,"Notice",string4,"Close","");
        Kick(OtherPlayer);
    }
    else {SendClientMessage(playerid, 0xFF0000, "You are not admin");}
  return 1;
}
Reply
#3

That doesnt work either... It only shows server closed the connection. No dialog at all
Reply
#4

Well then, as far as I am concerned, you cannot display messages for a player that is going to be kicked, read very carefully: https://sampwiki.blast.hk/wiki/Kick

That being said, the rule PROBABLY applies for dialogs as well.
Reply
#5

Thanks i can make it work now
Reply
#6

Quote:
Originally Posted by thimo
Посмотреть сообщение
Thanks i can make it work now
- Something I want to point out inside your (/kick) dialog it states if you think this ''Ban'' is unfair. You might want to fix that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)