SA-MP Forums Archive
2nd Problem :/ - 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: 2nd Problem :/ (/showthread.php?tid=272505)



2nd Problem :/ - fie - 28.07.2011

How annoying can scripting get? xD

Hopefully once iv been helped i will learn

Okay so back to the subject on the DM.

top of the script
Quote:

new Float:area51random[][8] =
{
// Positions, (X, Y, Z and Facing Angle)
{155.7807,1903.4863,18.6700,268.1238},
{210.1140,1838.3635,17.6406,353.6646},
{221.7679,1860.6051,13.1470,50.0417},
{202.8862,1872.8151,13.1406,238.6468},
{244.7581,1933.3304,17.6481,147.8027},
{243.1046,1863.9373,11.4609,24.2361},
{246.9140,1860.9084,14.0840,351.8174},
{259.4326,1852.4431,8.7578,105.5351}
};

Code:
Quote:

if(GetPlayerMenu(playerid) == DM)
{
switch(row)
{
case 0:
{
GameTextForPlayer(playerid,"~r~Welcome to Area51 DM",3000,4);
TogglePlayerControllable(playerid, 1);
HideMenuForPlayer(DM, playerid);
new rand = random(sizeof(area51random));

// SetPlayerPos to the random spawn data
SetPlayerPos(playerid, area51random[rand][0], area51random[rand][1],area51random[rand][2]);

// SetPlayerFacingAngle to the random facing angle data
SetPlayerFacingAngle(playerid, ,area51random[rand][8]);
return 1;
}

I want to be able to make a random spawn for the Area51 dm anyhelp?

---------------------------------------------------------------------------------------------
Get used to me i aint a bad scripter but i am still learning


Re: 2nd Problem :/ - Jay. - 28.07.2011

Try this , it's better for what your trying to achieve.
pawn Код:
switch(random(3))//Replace 3 with however many "cases" you have.
                {
                    case 0://always start at 0.
                    {
                       SetPlayerPos(playerid,x,y,z);
                    }
                    case 1:
                    {
                       SetPlayerPos(playerid,x,y,z);
                    }
                    case 2:
                    {

                       SetPlayerPos(playerid,x,y,z);

                    }
                    //etc



Re: 2nd Problem :/ - fie - 28.07.2011

I dont get it :/ Where would i put that?


Re: 2nd Problem :/ - Jay. - 28.07.2011

Quote:
Originally Posted by fie
Посмотреть сообщение
I dont get it :/ Where would i put that?
pawn Код:
if(GetPlayerMenu(playerid) == DM)
{
switch(row)
{
case 0:
{

  switch(random(3))//Replace 3 with however many "cases" you have.
                {
                    case 0://always start at 0.
                    {
                       SetPlayerPos(playerid,x,y,z);
                    }
                    case 1:
                    {
                       SetPlayerPos(playerid,x,y,z);
                    }
                    case 2:
                    {

                       SetPlayerPos(playerid,x,y,z);

                    }
                    //etc
}

return 1;
}



Re: 2nd Problem :/ - Laronic - 28.07.2011

pawn Код:
new Float:area51random[][4] = //4.. X, Y, Z, A
{
    // Positions, (X, Y, Z and Facing Angle)
    {155.7807,1903.4863,18.6700,268.1238},
    {210.1140,1838.3635,17.6406,353.6646},
    {221.7679,1860.6051,13.1470,50.0417},
    {202.8862,1872.8151,13.1406,238.6468},
    {244.7581,1933.3304,17.6481,147.8027},
    {243.1046,1863.9373,11.4609,24.2361},
    {246.9140,1860.9084,14.0840,351.8174},
    {259.4326,1852.4431,8.7578,105.5351}
};

//OnPlayerSelectedMenuRow
if(GetPlayerMenu(playerid) == DM)
    {
        switch(row)
        {
            case 0:
            {
                GameTextForPlayer(playerid,"~r~Welcome to Area51 DM",3000,4);
                TogglePlayerControllable(playerid, 1);
                HideMenuForPlayer(DM, playerid);
                new rspawn = random(sizeof(area51random));
                SetPlayerPos(playerid, RandomSpawn[rspawn][0], RandomSpawn[rspawn][1], RandomSpawn[rspawn][2]);
                SetPlayerFacingAngle(playerid, RandomSpawn[rspawn][3]);
            }
        }
    }
        //next case..