Jump to content
  • 0

pomoc switch-nejde...


Fisher

Dotaz

Ahoj lidi mám vytvořený příkaz na náhodný port, a když klepnu v dialogu na první položku, tak se nic nestane....mělo by mě to portnout někam na náhodnou pozici ze seznamu....
 

dcmd_testnahodnepozice(playerid, params[])
{
SPD(playerid, 82458, DIALOG_STYLE_LIST,"Test", "Test 1 \n Test 2", "Port", "Konec");
}
return 1;
}

if(dialogid == 82458)
{
if(response)
{
switch(listitem)
{
    case 0:
    {
    switch(random(15))
{
case 0:
{
SetPlayerPos(playerid, 2102.7300,3282.2676,350.1984);
}
case 1:
{
SetPlayerPos(playerid, 2128.0032,3363.1731,350.1953);
}
case 2:
  {
SetPlayerPos(playerid, 2053.0400,3330.4690,353.6875);
}
  case 3:
  {
    SetPlayerPos(playerid, 2114.7446,3273.6926,356.5938);
}
   case 4:
{
SetPlayerPos(playerid, 2142.1799,3385.4639,356.5938);
}
case 5:
  {
SetPlayerPos(playerid, 2130.0256,3259.8105,363.0000);
}
        case 6:
{
    SetPlayerPos(playerid, 2101.9478,3329.9832,363.0062);
}
   case 7:
{
SetPlayerPos(playerid, 2052.6594,3355.1643,368.0583);
}
   case 8:
{
SetPlayerPos(playerid, 2105.6104,3332.3047,369.4062);
}
        case 9:
{
  SetPlayerPos(playerid, 2145.0708,3293.7832,374.6580);
}
        case 11:
{
    SetPlayerPos(playerid, 2129.7512,3393.3142,375.7906);
}
        case 12:
{
SetPlayerPos(playerid, 2053.8066,3385.4800,382.1906);
}
   case 13:
{
    SetPlayerPos(playerid,2109.2759,3351.8667,382.1953);
}
        case 14:
{
    SetPlayerPos(playerid, 2135.4316,3277.1116,382.1953);
}
    }
    }
    case 1:
    {
    switch(random(15))
{
case 0:
{
    SetPlayerPos(playerid, 2055.0625,3409.5576,382.1953);
}
case 1:
{
    SetPlayerPos(playerid, 2081.9270,3468.8923,382.1953);
}
case 2:
  {
    SetPlayerPos(playerid, 2107.6304,3534.2932,382.1953);
}
  case 3:
  {
    SetPlayerPos(playerid, 2113.1589,3534.1558,375.7969);
}
   case 4:
{
    SetPlayerPos(playerid, 2077.4915,3448.3628,371.4728);
}
case 5:
  {
    SetPlayerPos(playerid, 2128.7837,3532.2119,369.3984);
}
        case 6:
{
    SetPlayerPos(playerid, 2143.8013,3500.6724,363.9753);
}
   case 7:
{
    SetPlayerPos(playerid, 2091.9219,3431.9836,363.0062);
}
   case 8:
{
    SetPlayerPos(playerid, 2098.9653,3457.3542,356.5938);
}
        case 9:
{
    SetPlayerPos(playerid, 2051.4407,3436.1980,350.1953);
}
        case 11:
{
    SetPlayerPos(playerid, 2081.9412,3532.6997,350.1953);
}
        case 12:
{
    SetPlayerPos(playerid, 2129.1809,3396.8235,356.5984);
}
   case 13:
{
    SetPlayerPos(playerid, 2085.3550,3460.0247,359.4160);
}
        case 14:
{
    SetPlayerPos(playerid, 2130.8540,3531.6340,363.0062);
 
    }
    }
    }
    }
    }
    }

Děkuju, nevím co s tím  :d
 

 

Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0

Ty musiš spus tit tym príkazom random ado case nedavaš pozicie ale stači od case 0 po 1 :d a k tym case case: 0 random .... teda aspom myslím

Nemôžeš spustit case a random ti nič nespravi len to ude bugovať nwm ako ale asi takto by to malo byť

Link to comment
Share on other sites

  • 0

Pokud se vyvede jen jedna funkce, nemusíš každou hodnotu otevřírat :). (prosím, dalo to v celu dost práce :d):

 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 82458)
	{
		if(!response) return 1;
		switch(listitem)
		{
    		case 0:
    		{
       		 	new c = random(15);
    			switch(c)
				{
					case 0: SetPlayerPos(playerid, 2102.7300,3282.2676,350.1984);
					case 1: SetPlayerPos(playerid, 2128.0032,3363.1731,350.1953);
					case 2: SetPlayerPos(playerid, 2053.0400,3330.4690,353.6875);
					case 3: SetPlayerPos(playerid, 2114.7446,3273.6926,356.5938);
					case 4: SetPlayerPos(playerid, 2142.1799,3385.4639,356.5938);
					case 5: SetPlayerPos(playerid, 2130.0256,3259.8105,363.0000);
					case 6: SetPlayerPos(playerid, 2101.9478,3329.9832,363.0062);
					case 7: SetPlayerPos(playerid, 2052.6594,3355.1643,368.0583);
					case 8: SetPlayerPos(playerid, 2105.6104,3332.3047,369.4062);
					case 9: SetPlayerPos(playerid, 2145.0708,3293.7832,374.6580);
					case 11: SetPlayerPos(playerid, 2129.7512,3393.3142,375.7906);
					case 12: SetPlayerPos(playerid, 2053.8066,3385.4800,382.1906);
					case 13: SetPlayerPos(playerid,2109.2759,3351.8667,382.1953);
					case 14: SetPlayerPos(playerid, 2135.4316,3277.1116,382.1953);
    			}
   	 		}
    		case 1:
 			{
				new a = random(15);
			    switch(a)
    			{
					case 0: SetPlayerPos(playerid, 2055.0625,3409.5576,382.1953);
					case 1: SetPlayerPos(playerid, 2081.9270,3468.8923,382.1953);
					case 2: SetPlayerPos(playerid, 2107.6304,3534.2932,382.1953);
					case 3: SetPlayerPos(playerid, 2113.1589,3534.1558,375.7969);
					case 4: SetPlayerPos(playerid, 2077.4915,3448.3628,371.4728);
					case 5: SetPlayerPos(playerid, 2128.7837,3532.2119,369.3984);
					case 6: SetPlayerPos(playerid, 2143.8013,3500.6724,363.9753);
					case 7: SetPlayerPos(playerid, 2091.9219,3431.9836,363.0062);
					case 8: SetPlayerPos(playerid, 2098.9653,3457.3542,356.5938);
					case 9: SetPlayerPos(playerid, 2051.4407,3436.1980,350.1953);
					case 10: SetPlayerPos(playerid, 2081.9412,3532.6997,350.1953);
					case 11: SetPlayerPos(playerid, 2129.1809,3396.8235,356.5984);
					case 12: SetPlayerPos(playerid, 2085.3550,3460.0247,359.4160);
					case 13: SetPlayerPos(playerid, 2130.8540,3531.6340,363.0062);

    			}
			}
		}
		return 1;
	}
	return 0;
}

 

Link to comment
Share on other sites

  • 0

Děkuju, ty jsi zlatý člověk :d Věřím, že to dalo moc práce :d Dík moc :)


A takhle by to šlo nebo ne? :d

public
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 82458)
    {
        if(!response) return 1;
        switch(listitem)
        {
        case 0:
        {
         
            switch(random(15)
                {
                    case 0: SetPlayerPos(playerid, 2102.7300,3282.2676,350.1984);
                    case 1: SetPlayerPos(playerid, 2128.0032,3363.1731,350.1953);
                    case 2: SetPlayerPos(playerid, 2053.0400,3330.4690,353.6875);
                    case 3: SetPlayerPos(playerid, 2114.7446,3273.6926,356.5938);
                    case 4: SetPlayerPos(playerid, 2142.1799,3385.4639,356.5938);
                    case 5: SetPlayerPos(playerid, 2130.0256,3259.8105,363.0000);
                    case 6: SetPlayerPos(playerid, 2101.9478,3329.9832,363.0062);
                    case 7: SetPlayerPos(playerid, 2052.6594,3355.1643,368.0583);
                    case 8: SetPlayerPos(playerid, 2105.6104,3332.3047,369.4062);
                    case 9: SetPlayerPos(playerid, 2145.0708,3293.7832,374.6580);
                    case 11: SetPlayerPos(playerid, 2129.7512,3393.3142,375.7906);
                    case 12: SetPlayerPos(playerid, 2053.8066,3385.4800,382.1906);
                    case 13: SetPlayerPos(playerid,2109.2759,3351.8667,382.1953);
                    case 14: SetPlayerPos(playerid, 2135.4316,3277.1116,382.1953);
            }
             }
        case 1:
            {
               
             switch(random(15))
            {
                    case 0: SetPlayerPos(playerid, 2055.0625,3409.5576,382.1953);
                    case 1: SetPlayerPos(playerid, 2081.9270,3468.8923,382.1953);
                    case 2: SetPlayerPos(playerid, 2107.6304,3534.2932,382.1953);
                    case 3: SetPlayerPos(playerid, 2113.1589,3534.1558,375.7969);
                    case 4: SetPlayerPos(playerid, 2077.4915,3448.3628,371.4728);
                    case 5: SetPlayerPos(playerid, 2128.7837,3532.2119,369.3984);
                    case 6: SetPlayerPos(playerid, 2143.8013,3500.6724,363.9753);
                    case 7: SetPlayerPos(playerid, 2091.9219,3431.9836,363.0062);
                    case 8: SetPlayerPos(playerid, 2098.9653,3457.3542,356.5938);
                    case 9: SetPlayerPos(playerid, 2051.4407,3436.1980,350.1953);
                    case 10: SetPlayerPos(playerid, 2081.9412,3532.6997,350.1953);
                    case 11: SetPlayerPos(playerid, 2129.1809,3396.8235,356.5984);
                    case 12: SetPlayerPos(playerid, 2085.3550,3460.0247,359.4160);
                    case 13: SetPlayerPos(playerid, 2130.8540,3531.6340,363.0062);

            }
            }
        }
        return 1;
    }
    return 0;
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...