Showplayerdialog problem
#1

Hello everybody !

I'm attempting on doing a basic elevator on my GM.
There are 3 levels.

I'm actually testing on the 2nd level, when a cop is pressing F, then a dialog will show up asking where he would like to go, there are 2 options "Up(+1)" and "Down(-1)".

The dialog shows up without any problem, the thing is that, when the player press Up or Down, nothing happens, why ? I can't figure it out, it's driving me crazy.

Here is the full code.

pawn Код:
new gps_currentDest[MAX_PLAYERS]; // ascenseur
forward CheckForWalkingTeleport(playerid);
forward PlayerToPointStripped(Float:radi, playerid, Float:x, Float:y, Float:z, Float:curx, Float:cury, Float:curz);
forward GetCityPlayer(playerid,activated);






public CheckForWalkingTeleport(playerid)
{
    new Float:cx, Float:cy, Float:cz;
    GetPlayerPos(playerid, cx, cy, cz);
   
    if(PlayerToPointStripped(1.0, playerid, 1524.4854,-1677.8744,6.2188, cx,cy,cz))
    { //Garage
        gps_currentDest[playerid] = 10;
        ShowPlayerDialog(playerid,911,DIALOG_STYLE_MSGBOX,"[Police] Elevator- Garage","Select your level","Up (+1)","Up (+2)");
        return 1;
    }
    if(IsACop(playerid) && PlayerToPointStripped(1.0, playerid, 1558.71, -1712.25, -7.79, cx,cy,cz))
    { //1st Floor
        gps_currentDest[playerid] = 11;
        ShowPlayerDialog(playerid,911,DIALOG_STYLE_MSGBOX,"[Police] Elevator - 1st floor","Select your level","","'(Down -1");
        return 1;
    }
    if(IsACop(playerid) &&  PlayerToPointStripped(1.0, playerid, 1558.0886,-1675.5081,28.3955, cx,cy,cz))
    { //Roof
        gps_currentDest[playerid] = 12;
        ShowPlayerDialog(playerid,911,DIALOG_STYLE_MSGBOX,"[Police] Elevator - Roof","Select your level","Down(-1)","Down(-2)");
        return 1;
    }
    return 1;
}



public PlayerToPointStripped(Float:radi, playerid, Float:x, Float:y, Float:z, Float:curx, Float:cury, Float:curz)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:tempposx, Float:tempposy, Float:tempposz;
        tempposx = (curx -x);
        tempposy = (cury -y);
        tempposz = (curz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) return 1;
    }
    return 0;
}

public GetCityPlayer(playerid,activated)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);

    if(activated)
    {
        if(x >= -2694.2791 && x < -2016.9351 && y >= 2163.9771 && y < 2570.9529)
            {return 5;} // BS
        else if(x >= -374.3679 && x < 178.0175 && y >= 981.3533 && y < 1257.3018)
            {return 4;} // FC
        else if(x >= -2977.2312 && x < -994.2332 && y >= -2964.7822 && y < 2973.1956)
            {return 1;} // SF
        else if(x >= -994.2332 && x < 2932.5674 && y >= -2964.7822 && y < 499.1327)
            {return 2;} // LS
        else if(x >= -994.2332 && x < 2932.5674 && y >= 499.1327 && y < 2973.1956)
            {return 3;} // LV
        else return 2;
    }
    else
    {
        if(x >= -2977.2312 && x < -994.2332 && y >= -2964.7822 && y < 2973.1956)
            {return 1;} // SF
        else if(x >= -994.2332 && x < 2932.5674 && y >= -2964.7822 && y < 499.1327)
            {return 2;} // LS
        else if(x >= -994.2332 && x < 2932.5674 && y >= 499.1327 && y < 2973.1956)
            {return 3;} // LV
        else return 2;
    }
}



    if(dialogid == 911) // Elevator Cops
    {
        if(GetCityPlayer(playerid,false) == 2)   // Elevator is in LS
        {
            if(gps_currentDest[playerid]==10) // Garage level
            {
                if(response==0) // Roof
                    {SetPlayerPosEx(playerid,1558.0886,-1675.5081,28.3955); SetPlayerVirtualWorld(playerid, 0);}
                if(response==1) // 1st floor
                    {SetPlayerPosEx(playerid,1558.71, -1712.25, -7.79); SetPlayerInterior(playerid, 6); SetPlayerVirtualWorld(playerid, 1); }
                return 1;
            }
            if(gps_currentDest[playerid]==11) // 1st floor
            {
                if(response==1) // Roof
                    {SetPlayerPosEx(playerid,1558.0886,-1675.5081,28.3955); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);}
                if(response==0) // Garage
                    {SetPlayerPosEx(playerid,1524.4854,-1677.8744,6.2188); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); }
                return 1;
            }
            if(gps_currentDest[playerid]==12) // Roof
            {
                if(response==1) // 1st floor
                    {SetPlayerPosEx(playerid,1558.71, -1712.25, -7.79); SetPlayerInterior(playerid, 6); SetPlayerVirtualWorld(playerid, 1);}
                if(response==0) // garage
                    {SetPlayerPosEx(playerid,1524.4854,-1677.8744,6.2188); SetPlayerVirtualWorld(playerid, 0);}
                return 1;
            }
        }
    }


And in :
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

In : if(newkeys == KEY_SECONDARY_ATTACK)

            else if(IsPlayerInRangeOfPoint(playerid, 1, 1558.71, -1712.25, -7.79))
            {
                ShowPlayerDialog(playerid,911,DIALOG_STYLE_MSGBOX,"[Police] Elevator - Garage","Select your level","(Up +1)","(Up+2");
            }


Thanks in advance for your help or advices.
Reply
#2

Little up, I seriously need your help on this, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)