I need some help :/
#1

Hey everyone, brand new to the forums and brand new to scripting so excuse my newbie question, iv searched everywhere high and low and cant seem to find my solution so it looks like ill be asking here, ANYWAYS on to the point... As i was saying im brand new to scripting just started this monday and i followed a tutorial to make a dialog box for teleports and so that you can teleport places, i wanted to make another dialog box that lets a player spawn weapons that i put in and i compiled it and there were about five errors, i fixed all those but theres one that i dont know how to fix here it is :

Код:
C:\Users\Me\Desktop\scripting\gamemodes\billjenkins.pwn(483) : error 021: symbol already defined: "OnDialogResponse"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And normally i would just go delete the other one but since its part of the teles i would have to delete the teles, i asked my freind whos fairly good at pawn, not amazing or anything and he linked me to this, https://sampwiki.blast.hk/wiki/OnDialogResponse i looked it over for a while but still i dont understand what to do :/

here are the two dialog boxs im trying to make....
Код:
 CMD:teles(playerid, params[])
{
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco\nArea 69\nAndromada\nLos Santos Airport\nO.G Loc's\nLiberty City(outside)(buggy)\nBank\n Liberty City(inside)\nLS Atrium\nSherman Damn\n8-Track\nBloodbowl\nDirt Track\nKickstart\nVice Stadium\nStar Tower\nVehicle Basketball", "Select", "Cancel");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) {
        case 1337:
        {
            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 );
                    }
                    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);
                    }
					case 12:
					{
					    SetPlayerInterior(playerid, 0);
					    SetPlayerPos (playerid, 214.3151,1871.5281,13.1406);
					}
					case 13:
					{
					    SetPlayerInterior(playerid, 9);
					    SetPlayerPos (playerid, 315.745086,984.969299,1958.919067);
						SendClientMessage(playerid, 0xFFFFFFFF, "I wouldn't suggest skydiving, as your in an interior");
					}
					case 14:
					{
					    SetPlayerInterior(playerid, 0);
					    SetPlayerPos (playerid, 2096.8315,-2454.4473,13.5469);
					}
					case 15:
					{
					    SetPlayerInterior(playerid, 3);
					    SetPlayerPos (playerid, 513.882507,-11.269994,1001.565307);
					}
					case 16:
					{
					    SetPlayerInterior(playerid, 1);
					    SetPlayerPos (playerid, -729.276000,503.086944,1371.971801);
					}
					case 17:
					{
					    SetPlayerInterior(playerid, 0);
					    SetPlayerPos (playerid, 2315.952880,-1.618174,26.742187);
					}
					case 18:
					{
					    SetPlayerInterior(playerid, 1);
					    SetPlayerPos (playerid, -794.806396,497.738037,1376.195312);
					}
					case 19:
					{
						SetPlayerInterior(playerid, 18);
						SetPlayerPos (playerid, 1710.433715,-1669.379272,20.225049);
					}
					case 20:
					{
					    SetPlayerInterior(playerid, 17);
					    SetPlayerPos (playerid, -959.564392,1848.576782,9.000000);
					}
					case 21:
					{
					    SetPlayerInterior(playerid, 7);
					    SetPlayerPos (playerid, -1398.065307,-217.028900,1051.115844);
					}
					case 22:
					{
					    SetPlayerInterior(playerid, 15);
					    SetPlayerPos (playerid, -1398.103515,937.631164,1036.479125);
					}
					case 23:
					{
					    SetPlayerInterior(playerid, 4);
					    SetPlayerPos (playerid, -1444.645507,-664.526000,1053.572998);
					}
					case 24:
					{
					    SetPlayerInterior(playerid, 14);
					    SetPlayerPos (playerid, -1465.268676,1557.868286,1052.531250);
					}
					case 25:
					{
					    SetPlayerInterior(playerid, 1);
					    SetPlayerPos (playerid, -1401.829956,107.051300,1032.273437);
					}
					case 26:
					{
						SetPlayerPos (playerid,1544.9849,-1353.7681,329.4735);
						SetPlayerInterior(playerid, 0);
					}
					case 27:
					{
					    SetPlayerPos(playerid, 3362.55, -1522.44, 323.67);
					    SetPlayerInterior(playerid, 0);
					}
    			}
            }
        }
    }
    return 0;
}
And then:
Код:
CMD:weapons(playerid, params[])
{
ShowPlayerDialog(playerid, 1338, DIALOG_STYLE_LIST, "Weapon Selection", "Deagle\nAK47\nM4\nMP5\nUZI\nTEC9\nBrass knuckles","Select","Cancel");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid) {
        case 1338:
        {
            if (!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
            if(response) {
                switch(listitem) {
				case 0:
				{
					GivePlayerWeapon(playerid, 24,9999);
					SendClientMessage(playerid, 0xFF9900AA, "You have recieved a deagle!");

				}
				case 1:
				{
				    GivePlayerWeapon(playerid, 30,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a AK47!");

				}
				case 2:
				{
				    GivePlayerWeapon(playerid, 31,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a M4!");

				}
				case 3:
				{
					GivePlayerWeapon(playerid, 29,9999);
					SendClientMessage(playerid, 0xFF9900AA, "You have recieved a MP5!");

				}
				case 4:
				{
				    GivePlayerWeapon(playerid, 28,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a UZI!");

				}
				case 5:
				{
				    GivePlayerWeapon(playerid, 32,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a TEC9!");

				}
				case 6:
				{
				    GivePlayerWeapon(playerid, 34,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a Sniper Rifle!");

				}
				case 7:
				{
				    GivePlayerWeapon(playerid, 1,9999);
				    SendClientMessage(playerid, 0xFF9900AA, "You have revieved Brass Knuckles!");

				}
			}
        }
    }
}
	return 0;
}
thanks in advance guys !
Reply
#2

You may not have two of the exact same publics in your script as you will get errors as 'Symbol already define bla bla bla', this is how your code should be. +rep if it helped you please!
pawn Код:
CMD:teles(playerid, params[])
{
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Teleport Selection", "Los Santos\nSan Fierro\nLas Venturas\nAircraft Carrier\nMount Chilliad\nPig Pen\nShamal\nJefferson Motel\nLSPD\nSFPD\nLVPD\nBinco\nArea 69\nAndromada\nLos Santos Airport\nO.G Loc's\nLiberty City(outside)(buggy)\nBank\n Liberty City(inside)\nLS Atrium\nSherman Damn\n8-Track\nBloodbowl\nDirt Track\nKickstart\nVice Stadium\nStar Tower\nVehicle Basketball", "Select", "Cancel");
return 1;
}
CMD:weapons(playerid, params[])
{
ShowPlayerDialog(playerid, 1338, DIALOG_STYLE_LIST, "Weapon Selection", "Deagle\nAK47\nM4\nMP5\nUZI\nTEC9\nBrass knuckles","Select","Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
        {
        case 1337:
            {
            if (!response)
                {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1;
                }
            switch(listitem)
                {
                case 0:
                    {
                    SetPlayerInterior (playerid, 0);
                    SetPlayerPos(playerid, 2498.5615,-1669.9823,13.3442);
                    return 1;
                    }
                case 1:
                    {
                    SetPlayerInterior (playerid, 0);
                    SetPlayerPos(playerid, -2900.9683,464.0657,4.9141);
                    return 1;
                    }
                case 2:
                    {
                    SetPlayerInterior (playerid, 0);
                    SetPlayerPos(playerid, 2000.7534,1529.9393,14.6223);
                    return 1;
                    }
                case 3:
                    {
                    SetPlayerInterior (playerid, 0);
                    SetPlayerPos(playerid, -1310.8959,499.1293,18.2344);
                    return 1;
                    }
                case 4:
                    {
                    SetPlayerInterior (playerid, 0);
                    SetPlayerPos(playerid, -2321.5945,-1636.9006,483.7031);
                    return 1;
                    }
                case 5:
                    {
                    SetPlayerInterior(playerid, 2);
                    SetPlayerPos(playerid, 1204.809936,-11.586799,1000.921875);
                    return 1;
                    }
                case 6:
                    {
                    SetPlayerInterior(playerid, 1);
                    SetPlayerPos(playerid, 1.808619,32.384357,1199.593750);
                    return 1;
                    }
                case 7:
                    {
                    SetPlayerInterior(playerid, 15);
                    SetPlayerPos(playerid, 2215.454833,-1147.475585,1025.796875);
                    return 1;
                    }
                case 8:
                    {
                    SetPlayerInterior(playerid, 6);
                    SetPlayerPos(playerid, 246.783996,63.900199,1003.640625);
                    return 1;
                    }
                case 9:
                    {
                    SetPlayerInterior(playerid, 10);
                    SetPlayerPos(playerid, 246.375991,109.245994,1003.218750);
                    return 1;
                    }
                case 10:
                    {
                    SetPlayerInterior(playerid, 3);
                    SetPlayerPos(playerid, 288.745971,169.350997,1007.171875);
                    return 1;
                    }
                case 11:
                    {
                    SetPlayerInterior(playerid, 15);
                    SetPlayerPos(playerid, 207.737991,-109.019996,1005.132812);
                    return 1;
                    }
                case 12:
                    {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 214.3151,1871.5281,13.1406);
                    return 1;
                    }
                case 13:
                    {
                    if(GetPlayerInterior(playerid) == 0)
                        {
                        SetPlayerInterior(playerid, 9);
                        SetPlayerPos(playerid, 315.745086,984.969299,1958.919067);
                        }
                    else
                        {
                        SendClientMessage(playerid, 0xFFFFFFFF, "I wouldn't suggest skydiving, as your in an interior");
                        }
                    return 1;
                    }
                case 14:
                    {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 2096.8315,-2454.4473,13.5469);
                    return 1;
                    }
                case 15:
                    {
                    SetPlayerInterior(playerid, 3);
                    SetPlayerPos(playerid, 513.882507,-11.269994,1001.565307);
                    return 1;
                    }
                case 16:
                    {
                    SetPlayerInterior(playerid, 1);
                    SetPlayerPos(playerid, -729.276000,503.086944,1371.971801);
                    return 1;
                    }
                case 17:
                    {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 2315.952880,-1.618174,26.742187);
                    return 1;
                    }
                case 18:
                    {
                    SetPlayerInterior(playerid, 1);
                    SetPlayerPos(playerid, -794.806396,497.738037,1376.195312);
                    return 1;
                    }
                case 19:
                    {
                    SetPlayerInterior(playerid, 18);
                    SetPlayerPos(playerid, 1710.433715,-1669.379272,20.225049);
                    return 1;
                    }
                case 20:
                    {
                    SetPlayerInterior(playerid, 17);
                    SetPlayerPos(playerid, -959.564392,1848.576782,9.000000);
                    return 1;
                    }
                case 21:
                    {
                    SetPlayerInterior(playerid, 7);
                    SetPlayerPos(playerid, -1398.065307,-217.028900,1051.115844);
                    return 1;
                    }
                case 22:
                    {
                    SetPlayerInterior(playerid, 15);
                    SetPlayerPos(playerid, -1398.103515,937.631164,1036.479125);
                    return 1;
                    }
                case 23:
                    {
                    SetPlayerInterior(playerid, 4);
                    SetPlayerPos(playerid, -1444.645507,-664.526000,1053.572998);
                    return 1;
                    }
                case 24:
                    {
                    SetPlayerInterior(playerid, 14);
                    SetPlayerPos(playerid, -1465.268676,1557.868286,1052.531250);
                    return 1;
                    }
                case 25:
                    {
                    SetPlayerInterior(playerid, 1);
                    SetPlayerPos(playerid, -1401.829956,107.051300,1032.273437);
                    return 1;
                    }
                case 26:
                    {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1544.9849,-1353.7681,329.4735);
                    return 1;
                    }
                case 27:
                    {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 3362.55, -1522.44, 323.67);
                    return 1;
                    }
                }
            }
        case 1338:
            {
            if (!response)
                {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1;
                }
            switch(listitem)
                {
                case 0:
                    {
                    GivePlayerWeapon(playerid, 24, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a deagle!");
                    return 1;
                    }
                case 1:
                    {
                    GivePlayerWeapon(playerid, 30, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a AK47!");
                    return 1;
                    }
                case 2:
                    {
                    GivePlayerWeapon(playerid, 31, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a M4!");
                    return 1;
                    }
                case 3:
                    {
                    GivePlayerWeapon(playerid, 29, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a MP5!");
                    return 1;
                    }
                case 4:
                    {
                    GivePlayerWeapon(playerid, 28, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a UZI!");
                    return 1;
                    }
                case 5:
                    {
                    GivePlayerWeapon(playerid, 32, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a TEC9!");
                    return 1;
                    }
                case 6:
                    {
                    GivePlayerWeapon(playerid, 34, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have recieved a Sniper Rifle!");
                    return 1;
                    }
                case 7:
                    {
                    GivePlayerWeapon(playerid, 1, 9999);
                    SendClientMessage(playerid, 0xFF9900AA, "You have revieved Brass Knuckles!");
                    return 1;
                    }
                }
            }
        }
   return 1;
}
Best regards,
Jesse

EDIT:
Editted the code, I had indeed forgot to add (playerid) behind GetPlayerInterior, sorry for that. Fixing that should also fix the loose indentation error.
Reply
#3

definatley +rep, you have no clue how much you helped me lol i was dumbfounded as to what to do, im really new to it but im learning slowly haha

EDIT:
Код:
C:\Users\Me\Desktop\scripting\gamemodes\billjenkins.pwn(422) : error 076: syntax error in the expression, or invalid function call
C:\Users\Me\Desktop\scripting\gamemodes\billjenkins.pwn(579) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 422 is this
Код:
 if (GetPlayerInterior == 0)
and line 579 is this
Код:
return 1;
at the very end :/
Reply
#4

for lose indentation just line return 1; with the line above it and for syntax error its
Quote:

if (GetPlayerInterior(playerid == 0))

Reply
#5

i dont understand what you mean about the loose indentation but thanks for the help with the error, if you could help me with the indentation that would be great!
Reply
#6

Quote:
Originally Posted by GreenIsGo
Посмотреть сообщение
i dont understand what you mean about the loose indentation but thanks for the help with the error, if you could help me with the indentation that would be great!
Loose indentation doesnt affect anything in the script, having the correct indentation can make your code a lot easy to read.. You basically want to match the opening and closing bracket

https://sampforum.blast.hk/showthread.php?tid=256961
Reply
#7

Ahhhh ok thanks man! that explains alot! +rep for you and vvhhy :P
Reply
#8

no problem bro
Reply
#9

As the user above me already pointed out, loose indentation doesn't affect how the script works, but affects the ability to be able to read it easily.
Reply
#10

Thanks for all the help guys!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)