What's wrong with this?
#1

I want it to kick the player if he click Disagree... but it doesn't work.

Code:
 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Server Rules:", "1. No Hacks, except drift lines \n2. No Deathmatching outside of designated DM areas \n3. Respect other players, especially admins \n4. Consider yourself warned!", "I Agree", "I Disagree");
Code:
            if(dialogid == 2)
            {
            	if(!response)
                {
                    SendClientMessage(playerid, COLOR_RED, "You Disagree with the rules, therefore you were kicked");
                    Kick(playerid);
                    return 1;
               	}
			}
		}
	}
	return 0;
}
Reply
#2

PHP Code:
if(dialogid == 2
Set it to 1.
Reply
#3

That didn't work. My Dialog id is 2, so why would I have to set it to if(dialogid == 1) ?
Reply
#4

pawn Code:
if(dialogid == 2)
    {
        if(!response)
        {
            SendClientMessage(playerid, COLOR_RED, "You Disagree with the rules, therefore you were kicked");
            Kick(playerid);
            return 1;
        }
    }
    return 0;
}
Try this. I aswell idented your code.
If it doesn't work, please paste your whole DialogResponse callback.
Reply
#5

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }

            switch(listitem)
            {
                case 0:
                {
                    SetPlayerHealth(playerid, 0);
                    SendClientMessage(playerid, COLOR_RED, "You chose to commit suicide");
                }
                case 1:
                {
                    SetPlayerHealth(playerid, 0);
                    ForceClassSelection(playerid);
                }
                case 2:
                {
                    SetPlayerHealth(playerid, 100);
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to heal yourself");
                }
                case 3:
                {
                    SetPlayerHealth(playerid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose to become invincible");
                }

                case 4:
                {
                    new vehicleid;
                    vehicleid = GetPlayerVehicleID(playerid);
                    SetVehicleHealth(vehicleid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose for your car to be invincible");
                }
                case 5:
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                    SendClientMessage(playerid, COLOR_TAN, "Type /cmds for a list of commands");
                    SendClientMessage(playerid, COLOR_TAN, "You can sign up for our clan on the forums");
                    SendClientMessage(playerid, COLOR_TAN, "www.driftingvenom.tk");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for unban, and ban on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for Admin on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can ask anyone for a drift battle on our forums");
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                }
                case 6:
                {
                    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Repair Failed: You must be in a vehicle to repair it");
                    RepairVehicle(GetPlayerVehicleID(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to repair your vehicle");
                }
                case 7:
                {
                    if(countspam[playerid]==0)
                     {
                        SetTimer("Five", 1000, 0);
                        SetTimer("Four", 2000, 0);
                        SetTimer("Three", 3000, 0);
                        SetTimer("Two", 4000, 0);
                        SetTimer("One", 5000, 0);
                        SetTimer("GoGoGo", 6000, 0);
                        countspam[playerid]=1;
                        SetTimer("countspam2",10000,0);
                    }
                    else
                    {
                        SendClientMessage(playerid,COLOR_BLUE, "Please wait before using this Command again.");
                    }
                }
            }
            if(dialogid == 2)
            {
                if(!response)
                {
                    SendClientMessage(playerid, COLOR_RED, "You Disagree with the rules, therefore you were kicked");
                    Kick(playerid);
                    return 1;
                }
            }
        }
    }
    return 0;
}
That's my whole Dialog response callback, cause your way did now work.
Reply
#6

pawn Code:
switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }

            switch(listitem)
            {
                case 0:
                {
                    SetPlayerHealth(playerid, 0);
                    SendClientMessage(playerid, COLOR_RED, "You chose to commit suicide");
                }
                case 1:
                {
                    SetPlayerHealth(playerid, 0);
                    ForceClassSelection(playerid);
                }
                case 2:
                {
                    SetPlayerHealth(playerid, 100);
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to heal yourself");
                }
                case 3:
                {
                    SetPlayerHealth(playerid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose to become invincible");
                }

                case 4:
                {
                    new vehicleid;
                    vehicleid = GetPlayerVehicleID(playerid);
                    SetVehicleHealth(vehicleid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose for your car to be invincible");
                }
                case 5:
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                    SendClientMessage(playerid, COLOR_TAN, "Type /cmds for a list of commands");
                    SendClientMessage(playerid, COLOR_TAN, "You can sign up for our clan on the forums");
                    SendClientMessage(playerid, COLOR_TAN, "www.driftingvenom.tk");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for unban, and ban on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for Admin on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can ask anyone for a drift battle on our forums");
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                }
                case 6:
                {
                    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Repair Failed: You must be in a vehicle to repair it");
                    RepairVehicle(GetPlayerVehicleID(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to repair your vehicle");
                }
                case 7:
                {
                    if(countspam[playerid]==0)
                     {
                        SetTimer("Five", 1000, 0);
                        SetTimer("Four", 2000, 0);
                        SetTimer("Three", 3000, 0);
                        SetTimer("Two", 4000, 0);
                        SetTimer("One", 5000, 0);
                        SetTimer("GoGoGo", 6000, 0);
                        countspam[playerid]=1;
                        SetTimer("countspam2",10000,0);
                    }
                    else
                    {
                        SendClientMessage(playerid,COLOR_BLUE, "Please wait before using this Command again.");
                    }
                }
            }
            case 2:
            {
                if(!response)
                {
                    SendClientMessage(playerid, COLOR_RED, "You Disagree with the rules, therefore you were kicked");
                    Kick(playerid);
                    return 1;
                }
            }
        }
    }
    return 0;
}
Give it a try now
Reply
#7

I can assure you that this will work. Also fully indented your codes, took me about 5-10 minutes. But this should do it instead of just posting random possible things like Delux13.

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerHealth(playerid, 0);
                    SendClientMessage(playerid, COLOR_RED, "You chose to commit suicide");
                }
                case 1:
                {
                    SetPlayerHealth(playerid, 0);
                    ForceClassSelection(playerid);
                }
                case 2:
                {
                    SetPlayerHealth(playerid, 100);
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to heal yourself");
                }
                case 3:
                {
                    SetPlayerHealth(playerid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose to become invincible");
                }
                case 4:
                {
                    new vehicleid;
                    vehicleid = GetPlayerVehicleID(playerid);
                    SetVehicleHealth(vehicleid, 100000);
                    SendClientMessage(playerid, COLOR_YELLOW, "You chose for your car to be invincible");
                }
                case 5:
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                    SendClientMessage(playerid, COLOR_TAN, "Type /cmds for a list of commands");
                    SendClientMessage(playerid, COLOR_TAN, "You can sign up for our clan on the forums");
                    SendClientMessage(playerid, COLOR_TAN, "www.driftingvenom.tk");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for unban, and ban on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can apply for Admin on our forums");
                    SendClientMessage(playerid, COLOR_TAN, "You can ask anyone for a drift battle on our forums");
                    SendClientMessage(playerid, COLOR_YELLOW, "-------------------Help Center-------------------");
                }
                case 6:
                {
                    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Repair Failed: You must be in a vehicle to repair it");
                    RepairVehicle(GetPlayerVehicleID(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "You chose to repair your vehicle");
                }
                case 7:
                {
                    if(countspam[playerid]==0)
                    {
                        SetTimer("Five", 1000, 0);
                        SetTimer("Four", 2000, 0);
                        SetTimer("Three", 3000, 0);
                        SetTimer("Two", 4000, 0);
                        SetTimer("One", 5000, 0);
                        SetTimer("GoGoGo", 6000, 0);
                        countspam[playerid]=1;
                        SetTimer("countspam2",10000,0);
                    }
                    else
                    {
                        SendClientMessage(playerid,COLOR_BLUE, "Please wait before using this Command again.");
                    }
                }
            }
        }
        case 2:
        {
            if(response) return SendClientMessage(playerid, COLOR_RED, "You Agreed with the rules, Enjoy your stay!");
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You Disagree with the rules, therefore you were kicked");
                Kick(playerid);
                return 1;
            }
        }
    }
    return 0;
}
Kind Regards,
Improvement™
Reply
#8

Quote:
Originally Posted by Improvement™
View Post
I can assure you that this will work. Also fully indented your codes, took me about 5-10 minutes. But this should do it instead of just posting random possible things like Delux13.


Kind Regards,
Improvement™
Well guess what, I think what I say.
We try to explain the solution.
I wasn't quite understanding his problem.
So I guess your like Einstein jr?

And next time don't say I post random stuff.
Reply
#9

Quote:
Originally Posted by Delux13
View Post
Well guess what, I think what I say, I don't copy and paste, then make an edit of it.
Plus this forums isn't just to give the code, we try to explain the solution.
I agree with this, but if the person himself wants us to explain what he did wrong, then we ofcourse will explain what went wrong. This person just wanted his codes to be fixed and lives happy ever after.


Quote:
Originally Posted by Delux13
View Post
And next time don't say I post random stuff.
But about this? You actually do post random things (in my opinion), because everytime I see you post on any topic. It is just like you read the main post one time, and then already start replying the "possible solution" without even putting effort into it to slove the problem. This is just my very first impression about you so far. Maybe it can change in meantime but I am just sharing what my opinion is.
Reply
#10

Quote:
Originally Posted by Improvement™
View Post
I agree with this, but if the person himself wants us to explain what he did wrong, then we ofcourse will explain what went wrong. This person just wanted his codes to be fixed and lives happy ever after.



But about this? You actually do post random things (in my opinion), because everytime I see you post on any topic. It is just like you read the main post one time, and then already start replying the "possible solution" without even putting effort into it to slove the problem. This is just my very first impression about you so far. Maybe it can change in meantime but I am just sharing what my opinion is.
I aswell try to figure it out what is wrong with the code, and what is not. And what can be modified and what can not.
So don't say I post random stuff.
'nuff said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)