Teleport Dialog not working.
#1

Okay, So I'm building a teleports filterscript for a freeroam server I've been trying to make
and it works, but it doesn't teleport you.

http://pastebin.com/fzwabmmz

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define COLOR_GREY 				0x808080FF
#define Teleid                  1337

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Teleport FS By Connorlolz");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/teles", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, Teleid, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco", "Select", "Cancel");

		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case 1:
		{
	   if(!response)
                {
                                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                            return 0; // We processed it
            }
		switch(listitem)
		 {
         case 0:
 		 {

			SetPlayerInterior (playerid, 0);
			SetPlayerPos(playerid, 2498.5615,-1669.9823,13.3442 );
		 }
		 case 1:
		 {
		 	SetPlayerInterior (playerid, 0);
			SetPlayerPos (playerid, -2900.9683,464.0657,4.9141 );
		 }
		 case 2:
		 {
		 	SetPlayerInterior (playerid, 0);
			SetPlayerPos (playerid, 2000.7534,1529.9393,14.6223 );
			SendClientMessage(playerid, 0xFF0000FF, "Welcome to LV");
		 }
		 case 3:
		 {
		 	SetPlayerInterior (playerid, 0);
			SetPlayerPos (playerid, -1310.8959,499.1293,18.2344 );
		 }
		 case 4:
		 {
		  	SetPlayerInterior (playerid, 0);
			SetPlayerPos (playerid, -2321.5945,-1636.9006,483.7031);
		 }
		 case 5:
		 {
		 	SetPlayerInterior(playerid, 2);
			SetPlayerPos (playerid, 1204.809936,-11.586799,1000.921875);
    	 }
		 case 6:
		 {
		    SetPlayerInterior(playerid, 1);
			SetPlayerPos (playerid, 1.808619,32.384357,1199.593750);
		 }
		 case 7:
		 {
		    SetPlayerInterior(playerid, 15);
			SetPlayerPos (playerid, 2215.454833,-1147.475585,1025.796875);
		 }
		 case 8:
		 {
		    SetPlayerInterior(playerid, 6);
			SetPlayerPos (playerid, 246.783996,63.900199,1003.640625);
		 }
		 case 9:
		 {
            SetPlayerInterior(playerid, 10);
			SetPlayerPos (playerid, 246.375991,109.245994,1003.218750);
		 }
		 case 10:
		 {
		    SetPlayerInterior(playerid, 3);
			SetPlayerPos (playerid, 288.745971,169.350997,1007.171875);
		 }
		 case 11:
		 {
		    SetPlayerInterior(playerid, 15);
			SetPlayerPos (playerid, 207.737991,-109.019996,1005.132812);
	 	 }
                        }
                }
        }
        return 1;
}
#endif
thanks ahead of time.
Reply
#2

So where did I read it as 1? I only see the #define at the top.

thanks though.
Reply
#3

above,he just didn't define FILTERSCRIPT and ended the ' if ' only at the bottom,and forgot to put the dialog id in the Dialog Response.
here: (try this)
pawn Код:
#include <a_samp>

#define COLOR_GREY              0x808080FF
#define Teleid                  1337

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Teleport FS By Connorlolz");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teles", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, Teleid, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco", "Select", "Cancel");

        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case Teleid:
        {
            if (!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
            if(response)
            {
        switch(listitem)
         {
                 case 0:
         {

            SetPlayerInterior (playerid, 0);
            SetPlayerPos(playerid, 2498.5615,-1669.9823,13.3442 );
         }
         case 1:
         {
            SetPlayerInterior (playerid, 0);
            SetPlayerPos (playerid, -2900.9683,464.0657,4.9141 );
         }
         case 2:
         {
            SetPlayerInterior (playerid, 0);
            SetPlayerPos (playerid, 2000.7534,1529.9393,14.6223 );
            SendClientMessage(playerid, 0xFF0000FF, "Welcome to LV");
         }
         case 3:
         {
            SetPlayerInterior (playerid, 0);
            SetPlayerPos (playerid, -1310.8959,499.1293,18.2344 );
         }
         case 4:
         {
            SetPlayerInterior (playerid, 0);
            SetPlayerPos (playerid, -2321.5945,-1636.9006,483.7031);
         }
         case 5:
         {
            SetPlayerInterior(playerid, 2);
            SetPlayerPos (playerid, 1204.809936,-11.586799,1000.921875);
         }
         case 6:
         {
            SetPlayerInterior(playerid, 1);
            SetPlayerPos (playerid, 1.808619,32.384357,1199.593750);
         }
         case 7:
         {
            SetPlayerInterior(playerid, 15);
            SetPlayerPos (playerid, 2215.454833,-1147.475585,1025.796875);
         }
         case 8:
         {
            SetPlayerInterior(playerid, 6);
            SetPlayerPos (playerid, 246.783996,63.900199,1003.640625);
         }
         case 9:
         {
            SetPlayerInterior(playerid, 10);
            SetPlayerPos (playerid, 246.375991,109.245994,1003.218750);
         }
         case 10:
         {
            SetPlayerInterior(playerid, 3);
            SetPlayerPos (playerid, 288.745971,169.350997,1007.171875);
         }
         case 11:
         {
            SetPlayerInterior(playerid, 15);
            SetPlayerPos (playerid, 207.737991,-109.019996,1005.132812);
         }
                        }
                }
        }
        return 1;
}
Reply
#4

Thanks! but when I put in the code, everything seems to run except for:

122) : error 002: only a single statement (or expression) can follow each "case"

There isn't a line 122 though.. it closes off at 121

EDIT: Missed the posts below, thanks!
Reply
#5

keep this in mind
good indentation helps see the errors

pawn Код:
#include <a_samp>

#define COLOR_GREY              0x808080FF
#define Teleid                  1337

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Teleport FS By Connorlolz");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teles", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, Teleid, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco", "Select", "Cancel");

        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case Teleid:
        {
            if (!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
            if(response)
            {
                switch(listitem)
                {
                     case 0:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos(playerid, 2498.5615,-1669.9823,13.3442 );
                    }
                    case 1:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -2900.9683,464.0657,4.9141 );
                    }
                    case 2:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, 2000.7534,1529.9393,14.6223 );
                        SendClientMessage(playerid, 0xFF0000FF, "Welcome to LV");
                    }
                    case 3:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -1310.8959,499.1293,18.2344 );
                    }
                    case 4:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -2321.5945,-1636.9006,483.7031);
                    }
                    case 5:
                    {
                        SetPlayerInterior(playerid, 2);
                        SetPlayerPos (playerid, 1204.809936,-11.586799,1000.921875);
                    }
                    case 6:
                    {
                        SetPlayerInterior(playerid, 1);
                        SetPlayerPos (playerid, 1.808619,32.384357,1199.593750);
                    }
                    case 7:
                    {
                        SetPlayerInterior(playerid, 15);
                        SetPlayerPos (playerid, 2215.454833,-1147.475585,1025.796875);
                    }
                    case 8:
                    {
                        SetPlayerInterior(playerid, 6);
                        SetPlayerPos (playerid, 246.783996,63.900199,1003.640625);
                    }
                    case 9:
                    {
                        SetPlayerInterior(playerid, 10);
                        SetPlayerPos (playerid, 246.375991,109.245994,1003.218750);
                    }
                    case 10:
                    {
                        SetPlayerInterior(playerid, 3);
                        SetPlayerPos (playerid, 288.745971,169.350997,1007.171875);
                    }
                    case 11:
                    {
                        SetPlayerInterior(playerid, 15);
                        SetPlayerPos (playerid, 207.737991,-109.019996,1005.132812);
                    }
                }
            }
        }
    } // <-- missed
    return 1;
}
Reply
#6

Alright, thanks! but I put in the code, and it loads up with no errors.

but when I select something on the dialog it doesn't send me anywhere.
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
Fix your indentation.
no,its not solution,i've just forgot 1 baracket.(he too)
here the fixed script:
pawn Код:
#include <a_samp>

#define COLOR_GREY              0x808080FF
#define Teleid                  1337

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Teleport FS By Connorlolz");
    print("--------------------------------------\n");
    return 1;
}


public OnFilterScriptExit()
{
    return 1;
}


#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teles", cmdtext, true, 10) == 0) {
        ShowPlayerDialog(playerid, Teleid, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco", "Select", "Cancel");

        return 1;
    }
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) {
        case Teleid:
        {
            if (!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
            if(response) {
                switch(listitem) {
                    case 0:
                    {

                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos(playerid, 2498.5615,-1669.9823,13.3442 );
                    }
                    case 1:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -2900.9683,464.0657,4.9141 );
                    }
                    case 2:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, 2000.7534,1529.9393,14.6223 );
                        SendClientMessage(playerid, 0xFF0000FF, "Welcome to LV");
                    }
                    case 3:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -1310.8959,499.1293,18.2344 );
                    }
                    case 4:
                    {
                        SetPlayerInterior (playerid, 0);
                        SetPlayerPos (playerid, -2321.5945,-1636.9006,483.7031);
                    }
                    case 5:
                    {
                        SetPlayerInterior(playerid, 2);
                        SetPlayerPos (playerid, 1204.809936,-11.586799,1000.921875);
                    }
                    case 6:
                    {
                        SetPlayerInterior(playerid, 1);
                        SetPlayerPos (playerid, 1.808619,32.384357,1199.593750);
                    }
                    case 7:
                    {
                        SetPlayerInterior(playerid, 15);
                        SetPlayerPos (playerid, 2215.454833,-1147.475585,1025.796875);
                    }
                    case 8:
                    {
                        SetPlayerInterior(playerid, 6);
                        SetPlayerPos (playerid, 246.783996,63.900199,1003.640625);
                    }
                    case 9:
                    {
                        SetPlayerInterior(playerid, 10);
                        SetPlayerPos (playerid, 246.375991,109.245994,1003.218750);
                    }
                    case 10:
                    {
                        SetPlayerInterior(playerid, 3);
                        SetPlayerPos (playerid, 288.745971,169.350997,1007.171875);
                    }
                    case 11:
                    {
                        SetPlayerInterior(playerid, 15);
                        SetPlayerPos (playerid, 207.737991,-109.019996,1005.132812);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#8

Works!, thanks everyone!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)