Dialog to Callbacks? Comeon anyone?
#1

Hey guys how can i do something like this.
I have a dialog, if you are zombie and you type /class it will show you DIALOG_STYLE_LIST with 2 lists
so if the player selects the first one then it teleports him to the nearest player i have all this but i want to do it with dialog and to teleport to nearest player it needs a Callbacks/Function this one
pawn Код:
forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
i don't think it will work under OnDialogResponse... How can i make it dialog?
HEre's my Dialog command
pawn Код:
command(Class,playerid,params[])
{
    if(gTeam[playerid] == Zombie)
    {
        ShowPlayerDialog(playerid, ZCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite(30HP)\n{00FF00}High Jump", "Select", "Cancle");
    }
    else if(gTeam[playerid] == Vampire)
    {
        ShowPlayerDialog(playerid, VCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite (30HP)\n{00FF00}Tp to nearest player", "Select", "Cancle");
    }
    return 1;
}
and here OnDialogResponse (No idea how to do it all i got is this)
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    case DIALOG_ZCLASS:
    {
        if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
        if(response)
        {
and here teleports you to nearest player
pawn Код:
forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
{
    new Float:dist = 1000.0;
    new targetid = INVALID_PLAYER_ID;
    new Float:x1,Float:y1,Float:z1;
    new Float:x2,Float:y2,Float:z2;
    new Float:tmpdis;
    GetPlayerPos(playerid,x1,y1,z1);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(i == playerid) continue;
        GetPlayerPos(i,x2,y2,z2);
        tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
        if(tmpdis < dist)
        {
            dist = tmpdis;
            targetid = i;
        }
    }
    return targetid;
}
Any idea how to do it?
Would appreciate any help
Reply


Messages In This Thread
Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 05:48
Re: Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 06:10
Re: Dialog to Callbacks? Comeon anyone? - by [MM]RoXoR[FS] - 20.06.2012, 06:28
Re: Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 06:30
Re : Dialog to Callbacks? Comeon anyone? - by mehdi-jumper - 20.06.2012, 07:11
Re: Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 07:17
Re: Dialog to Callbacks? Comeon anyone? - by [MM]RoXoR[FS] - 20.06.2012, 07:31
Re: Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 07:34
Re: Dialog to Callbacks? Comeon anyone? - by [MM]RoXoR[FS] - 20.06.2012, 07:43
Re: Dialog to Callbacks? Comeon anyone? - by Rudy_ - 20.06.2012, 08:03

Forum Jump:


Users browsing this thread: 4 Guest(s)