Menu dialog error code help
#1

C:\Users\Jonathan\Desktop\Is_elevator.pwn(41) : error 017: undefined symbol "playerid"
C:\Users\Jonathan\Desktop\Is_elevator.pwn(292) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Code:
// By Shabi RoxX

#include <a_samp>


//forwad your function
forward IsPlayerInArea();

main()
{
    print("\n----------------------------------");
    print("            Elevator                ");
    print("----------------------------------\n");
}




public OnGameModeInit()
{
    // you must create menu in OnGameModeInit


    SetTimer("IsPlayerInArea", 1000, true);//will repeat every 1 second to check if any player on pos :)

    SetGameModeText("Cops Robbers RPG");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public IsPlayerInArea()
{
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        GetPlayerPos(i, X, Y, Z);
        if(IsPlayerConnected(i))//checking if player is connected else nothing
        {
            if (X <= -1915.6198 && X >= -1917.0597 && Y <= 1114.1592 && Y >=  1111.3760)
            {
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "what floor do you want?", "Ground floor /nFirst Floor /nSecond Floor /nThirdFloor /nFourth Floor /nFifth Floor /nSixthFloor /nSeventh Floor /nEighth Floor /nNineth Floor /nTenthfloor /nEleventh Floor /nTwelefth Floor /nThirteenth Floor /nFourteenth Floor /nFifteenth Floor /nSixteenth Floor /nSeventeenth Floor /nEighteenth Floor /nNineteenth Floor /nRoof", "Select", "Cancel");
                return 1;
            }
        }
    }
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lift", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
		case 1:// Our dialog!
    	    {
           	switch(listitem)// Checking which listitem was selected
        	{
            case 0:
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100);}
            case 1: //Ground
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (1 * 5.45155));}
            case 2: //First
            {SetPlayerPos(playerid, -1916.9716,1112.4375,48.7100+ 8.7396 + (2 * 5.45155));}
            case 3: //Second
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (3 * 5.45155));}
            case 4: //Third
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (4 * 5.45155) );}
            case 5: //Fourth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (5 * 5.45155));}
            case 6: //Fifth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (6 * 5.45155));}
            case 7: //Sixth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (7 * 5.45155));}
            case 8: //Seventh
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (8 * 5.45155));}
            case 9: //Eighth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (9 * 5.45155));}
            case 10: //Ninth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (10 * 5.45155));}
            case 11: //Tenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (11 * 5.45155));}
            case 12: //Eleventh
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (12 * 5.45155));}
            case 13: //Twelth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (13 * 5.45155));}
            case 14: //Thirteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (14 * 5.45155));}
            case 15: //Fourteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (15 * 5.45155));}
            case 16: //Fifteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (16 * 5.45155));}
            case 17: //Sixteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (17 * 5.45155));}
            case 18: //Seventeenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (18 * 5.45155));}
            case 19: //Eighteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (19 * 5.45155));}
            case 20: //Nineteenth
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (20 * 5.45155));}
            case 21: //Penthouse
            {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (21 * 5.45155));}
        	    }
				}

    	    }
		}
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#2

pawn Code:
// By Shabi RoxX

#include <a_samp>


//forwad your function
forward IsPlayerInArea();

main()
{
    print("\n----------------------------------");
    print("            Elevator                ");
    print("----------------------------------\n");
}




public OnGameModeInit()
{
    // you must create menu in OnGameModeInit


    SetTimer("IsPlayerInArea", 1000, true);//will repeat every 1 second to check if any player on pos :)

    SetGameModeText("Cops Robbers RPG");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public IsPlayerInArea()
{
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        GetPlayerPos(i, X, Y, Z);
        if(IsPlayerConnected(i))//checking if player is connected else nothing
        {
            if (X <= -1915.6198 && X >= -1917.0597 && Y <= 1114.1592 && Y >=  1111.3760)
            {
                ShowPlayerDialog(i, 1, DIALOG_STYLE_LIST, "what floor do you want?", "Ground floor /nFirst Floor /nSecond Floor /nThirdFloor /nFourth Floor /nFifth Floor /nSixthFloor /nSeventh Floor /nEighth Floor /nNineth Floor /nTenthfloor /nEleventh Floor /nTwelefth Floor /nThirteenth Floor /nFourteenth Floor /nFifteenth Floor /nSixteenth Floor /nSeventeenth Floor /nEighteenth Floor /nNineteenth Floor /nRoof", "Select", "Cancel");
                return 1;
            }
        }
    }
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lift", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
    {
        case 1:// Our dialog!
        {
            switch(listitem)// Checking which listitem was selected
            {
                case 0:
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100);}
                case 1: //Ground
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (1 * 5.45155));}
                case 2: //First
                {SetPlayerPos(playerid, -1916.9716,1112.4375,48.7100+ 8.7396 + (2 * 5.45155));}
                case 3: //Second
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (3 * 5.45155));}
                case 4: //Third
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (4 * 5.45155) );}
                case 5: //Fourth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (5 * 5.45155));}
                case 6: //Fifth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (6 * 5.45155));}
                case 7: //Sixth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (7 * 5.45155));}
                case 8: //Seventh
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (8 * 5.45155));}
                case 9: //Eighth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (9 * 5.45155));}
                case 10: //Ninth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (10 * 5.45155));}
                case 11: //Tenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (11 * 5.45155));}
                case 12: //Eleventh
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (12 * 5.45155));}
                case 13: //Twelth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (13 * 5.45155));}
                case 14: //Thirteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (14 * 5.45155));}
                case 15: //Fourteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (15 * 5.45155));}
                case 16: //Fifteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (16 * 5.45155));}
                case 17: //Sixteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (17 * 5.45155));}
                case 18: //Seventeenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (18 * 5.45155));}
                case 19: //Eighteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (19 * 5.45155));}
                case 20: //Nineteenth
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (20 * 5.45155));}
                case 21: //Penthouse
                {SetPlayerPos(playerid,-1916.9716,1112.4375,48.7100+ 8.7396 + (21 * 5.45155));}
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#3

Replace the playerid in this
Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "what floor do you want?", "Ground floor /nFirst Floor /nSecond Floor /nThirdFloor /nFourth Floor /nFifth Floor /nSixthFloor /nSeventh Floor /nEighth Floor /nNineth Floor /nTenthfloor /nEleventh Floor /nTwelefth Floor /nThirteenth Floor /nFourteenth Floor /nFifteenth Floor /nSixteenth Floor /nSeventeenth Floor /nEighteenth Floor /nNineteenth Floor /nRoof", "Select", "Cancel");
with "i"
Code:
ShowPlayerDialog(i, 1, DIALOG_STYLE_LIST, "what floor do you want?", "Ground floor /nFirst Floor /nSecond Floor /nThirdFloor /nFourth Floor /nFifth Floor /nSixthFloor /nSeventh Floor /nEighth Floor /nNineth Floor /nTenthfloor /nEleventh Floor /nTwelefth Floor /nThirteenth Floor /nFourteenth Floor /nFifteenth Floor /nSixteenth Floor /nSeventeenth Floor /nEighteenth Floor /nNineteenth Floor /nRoof", "Select", "Cancel");
And remove one bracket above return 1; at the OnDialogResponse function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)