SA-MP Forums Archive
Whats wrong with this - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this (/showthread.php?tid=244899)



Whats wrong with this - ShawnMiller1337 - 29.03.2011

Код:
if (dialogid == PHINT) // Property House Interiors
	{
        if (response == 1) // OK
        {
			switch (listitem)
			{
				case 0: //
				{
				    SetPlayerPos(playerid, 222.9534, 1287.7649, 1082.1406);
				    SetPlayerInterior(playerid, 1);
			    }
			    case 1:
			    {
					SetPlayerPos(playerid, 261.0827,1284.6899,1080.2578);
					SetPlayerInterior(playerid,4);
			    }
			    case 2:
			    {
					SetPlayerPos(playerid, 260.6734,1237.7909,1084.2578);
					SetPlayerInterior(playerid,9);
			    }
			    case 3:
			    {
					SetPlayerPos(playerid, 376.7426,1417.3226,1081.3281);
					SetPlayerInterior(playerid,15);
			    }
			    case 4:
			    {
					SetPlayerPos(playerid, 295.2874,1473.2769,1080.2578);
					SetPlayerInterior(playerid,15);
			    }
			    case 5:
			    {
					SetPlayerPos(playerid, 327.9431,1478.3801,1084.4375);
					SetPlayerInterior(playerid,15);
			    }
			    case 6:
			    {
					SetPlayerPos(playerid, 2270.1050,-1210.3917,1047.5625);
					SetPlayerInterior(playerid,10);
			    }
			    case 7:
			    {
					SetPlayerPos(playerid, 447.1211,1397.8444,1084.3047);
					SetPlayerInterior(playerid,2);
			    }
			    case 8:
			    {
					SetPlayerPos(playerid, 2196.0063,-1204.6326,1049.0234);
					SetPlayerInterior(playerid,6);
			    }
			    case 9:
			    {
					SetPlayerPos(playerid, 235.3416,1187.2882,1080.2578);
					SetPlayerInterior(playerid,3);
			    }
			    case 10:
			    {
					SetPlayerPos(playerid, 490.9987,1399.4164,1080.2578);
					SetPlayerInterior(playerid,2);
			    }
			    case 11:
			    {
					SetPlayerPos(playerid, 227.1212,1114.1840,1080.9972);
					SetPlayerInterior(playerid,5);
			    }
			    case 12:
			    {
					SetPlayerPos(playerid, 225.6624,1022.5345,1084.0145);
					SetPlayerInterior(playerid,7);
			    }
			    case 13:
			    {
					SetPlayerPos(playerid, 963.8746,-52.8705,1001.1246);
					SetPlayerInterior(playerid,3);
			    }
			    case 14:
			    {
					SetPlayerPos(playerid, -2159.122802,641.517517,1052.381713);
					SetPlayerInterior(playerid,1);
			    }
			}
        }
        else // CANCEL
        {

        }
		return 1;
    }
When I click on case whatever dosn't teleport me to the coords ?


Re: Whats wrong with this - Skylar Paul - 29.03.2011

Incorrect:
pawn Код:
if(response == 1) { }
Correct:
pawn Код:
if(response) { }



Re: Whats wrong with this - ShawnMiller1337 - 29.03.2011

C:\Documents and Settings\Owner\Desktop\03cCore\gamemodes\EGv75.pwn (43089) : error 029: invalid expression, assumed zero

Код:
if (dialogid == DPHINT) // Property House Interiors
	{
        if(response) { }
        {
			switch (listitem)
			{
				case 0: //
				{
				    //SetPlayerPos(playerid, 222.9534, 1287.7649, 1082.1406);
				    //SetPlayerInterior(playerid, 1);
				    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
			    }
			    case 1:
			    {
					SetPlayerPos(playerid, 261.0827,1284.6899,1080.2578);
					SetPlayerInterior(playerid,4);
			    }
			    case 2:
			    {
					SetPlayerPos(playerid, 260.6734,1237.7909,1084.2578);
					SetPlayerInterior(playerid,9);
			    }
			    case 3:
			    {
					SetPlayerPos(playerid, 376.7426,1417.3226,1081.3281);
					SetPlayerInterior(playerid,15);
			    }
			    case 4:
			    {
					SetPlayerPos(playerid, 295.2874,1473.2769,1080.2578);
					SetPlayerInterior(playerid,15);
			    }
			    case 5:
			    {
					SetPlayerPos(playerid, 327.9431,1478.3801,1084.4375);
					SetPlayerInterior(playerid,15);
			    }
			    case 6:
			    {
					SetPlayerPos(playerid, 2270.1050,-1210.3917,1047.5625);
					SetPlayerInterior(playerid,10);
			    }
			    case 7:
			    {
					SetPlayerPos(playerid, 447.1211,1397.8444,1084.3047);
					SetPlayerInterior(playerid,2);
			    }
			    case 8:
			    {
					SetPlayerPos(playerid, 2196.0063,-1204.6326,1049.0234);
					SetPlayerInterior(playerid,6);
			    }
			    case 9:
			    {
					SetPlayerPos(playerid, 235.3416,1187.2882,1080.2578);
					SetPlayerInterior(playerid,3);
			    }
			    case 10:
			    {
					SetPlayerPos(playerid, 490.9987,1399.4164,1080.2578);
					SetPlayerInterior(playerid,2);
			    }
			    case 11:
			    {
					SetPlayerPos(playerid, 227.1212,1114.1840,1080.9972);
					SetPlayerInterior(playerid,5);
			    }
			    case 12:
			    {
					SetPlayerPos(playerid, 225.6624,1022.5345,1084.0145);
					SetPlayerInterior(playerid,7);
			    }
			    case 13:
			    {
					SetPlayerPos(playerid, 963.8746,-52.8705,1001.1246);
					SetPlayerInterior(playerid,3);
			    }
			    case 14:
			    {
					SetPlayerPos(playerid, -2159.122802,641.517517,1052.381713);
					SetPlayerInterior(playerid,1);
			    }
			}
        }
        else // CANCEL
        {

        }
		return 1;
    }



Re: Whats wrong with this - JamesC - 29.03.2011

Quote:
Originally Posted by Skylar Paul
Посмотреть сообщение
Incorrect:
pawn Код:
if(response == 1) { }
Correct:
pawn Код:
if(response) { }

They're both correct...

@OP: Your initial code seems fine, please post your ShowPlayerDialog (maybe you're using different Dialog ID's)


Re: Whats wrong with this - ShawnMiller1337 - 29.03.2011

Not that , the dialog comes up put when you click on w/e I named it dosnt teleport the player


Re: Whats wrong with this - JamesC - 29.03.2011

Yes, the dialog will show up regardless of the ID you use, but the ID on the dialog and the ID you're comparing should match. That is why I said to post your ShowPlayerDialog code or at least make sure that the ID value is the same.


Re: Whats wrong with this - Gamer_Z - 29.03.2011

pawn Код:
if (dialogid == DPHINT) // Property House Interiors
    {
        if(response) { }
        {
You silly boy, remove the { } after if(response)
Looks like only me is looking at the code right.. ;P

also do a SendClientMessage in the else statement to see if it gets executed every time.
So we can debug your code. But it looks fine!


Re: Whats wrong with this - ShawnMiller1337 - 30.03.2011

Код:
if(strcmp(cmd, "/phint", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
             if(PlayerInfo[playerid][pAdmin] >= 1337)
             {
                 ShowPlayerDialog(playerid,DPHINT,DIALOG_STYLE_LIST,"Property House - Interiors","Interior 1\nInt2\nInt3\nInt4\nInt5\nInt6\nInt7\nInt8\nInt8\nInt9\nInt10\nInt11\nInt12\nInt13\nInt14","Select","Exit");
             }
             else
             {
				 SendClientMessage(playerid,COLOR_YELLOW,"You are not admin");
             }
        }
		return 1;
	}
Код:
if (dialogid == DPHINT) // Property House Interiors
	{
        if(response)
        {
			switch (listitem)
			{
				case 0: //
				{
				    SetPlayerPos(playerid, 222.9534, 1287.7649, 1082.1406);
				    SetPlayerInterior(playerid, 1);
			    }
			    case 1:
			    {
					SetPlayerPos(playerid, 261.0827,1284.6899,1080.2578);
					SetPlayerInterior(playerid,4);
			    }
			    case 2:
			    {
					SetPlayerPos(playerid, 260.6734,1237.7909,1084.2578);
					SetPlayerInterior(playerid,9);
			    }
			    case 3:
			    {
					SetPlayerPos(playerid, 376.7426,1417.3226,1081.3281);
					SetPlayerInterior(playerid,15);
			    }
			    case 4:
			    {
					SetPlayerPos(playerid, 295.2874,1473.2769,1080.2578);
					SetPlayerInterior(playerid,15);
			    }
			    case 5:
			    {
					SetPlayerPos(playerid, 327.9431,1478.3801,1084.4375);
					SetPlayerInterior(playerid,15);
			    }
			    case 6:
			    {
					SetPlayerPos(playerid, 2270.1050,-1210.3917,1047.5625);
					SetPlayerInterior(playerid,10);
			    }
			    case 7:
			    {
					SetPlayerPos(playerid, 447.1211,1397.8444,1084.3047);
					SetPlayerInterior(playerid,2);
			    }
			    case 8:
			    {
					SetPlayerPos(playerid, 2196.0063,-1204.6326,1049.0234);
					SetPlayerInterior(playerid,6);
			    }
			    case 9:
			    {
					SetPlayerPos(playerid, 235.3416,1187.2882,1080.2578);
					SetPlayerInterior(playerid,3);
			    }
			    case 10:
			    {
					SetPlayerPos(playerid, 490.9987,1399.4164,1080.2578);
					SetPlayerInterior(playerid,2);
			    }
			    case 11:
			    {
					SetPlayerPos(playerid, 227.1212,1114.1840,1080.9972);
					SetPlayerInterior(playerid,5);
			    }
			    case 12:
			    {
					SetPlayerPos(playerid, 225.6624,1022.5345,1084.0145);
					SetPlayerInterior(playerid,7);
			    }
			    case 13:
			    {
					SetPlayerPos(playerid, 963.8746,-52.8705,1001.1246);
					SetPlayerInterior(playerid,3);
			    }
			    case 14:
			    {
					SetPlayerPos(playerid, -2159.122802,641.517517,1052.381713);
					SetPlayerInterior(playerid,1);
			    }
			}
        }
        else // CANCEL
        {

        }
		return 1;
    }