Help with OnPlayerSpawn
#1

Hi guys,

I create random spawns for players. I mean, in OnePlayerRequestClass there are different skins in it. So people have many choices to choose a skin they want. First skins are Business man and Business Woman. They spawn in a place in SF, (Random spawns) . Secons skins are medic, they spawns at the hospital in SF, Hobo spawns in another place etc etc. But when a player use medic, hobo or whatever they spawns all the time @ the first place by the business man and woman spawn zone. Not where they must be spawned. Same as for players/admins who changed there skin by typing /skin <skinid> will spawn by the business man and woman spawn zone.

Whats wrong?


pawn Код:
//==============================================================================
//==============================================================================
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//==============================================================================
// OnPlayerSpawn
//==============================================================================

// Default (Without "team" skin)
new Float:dRandomSpawns[4][4] = {
{-2721.3625,-317.9877,7.8438,43.9661},
{-2759.6143,-342.8159,7.1797,272.3415},
{-2719.3250,-278.6085,7.1875,181.4974},
{-2800.4924,-309.4407,7.1875,261.6881}
};
// Business man/woman
new Float:bRandomSpawns[4][4] = {
{-2643.1094, 1382.2068, 7.1754, 177.7266},
{-2612.9094, 1353.9767, 7.1578, 88.1124},
{-2656.9878, 1349.4407, 7.0531, 268.5707},
{-2641.0459, 1329.4741, 7.1953, 358.1848}
};

// Medic
new Float:mRandomSpawns[4][4] = {
{-2641.4456, 634.5406, 14.4531, 179.1237},
{-2670.9009, 616.7023, 14.4545, 268.0645},
{-2709.3545, 590.5337, 14.4531, 264.2343},
{-2683.7671, 637.9122, 14.4531, 175.5602}
};

// Hobo
new Float:hoRandomSpawns[4][4] = {
{-1704.9688, 993.6555, 17.9141, 87.4338},
{-1701.9067, 1040.2960, 17.9141, 180.8080},
{-1722.2537, 1040.2469, 17.9141, 175.4579},
{-1738.4052, 1003.7330, 17.9141, 272.2788}
};

// Police
new Float:pRandomSpawns[4][4] = {
{-1616.0428, 685.9863, 7.1875, 176.7121},
{-1639.1235, 674.6732, 7.1875, 260.9996},
{-1693.4172, 693.3384, 30.1838, 310.1934},
{-1621.6307, 677.7749, -4.9063, 269.1230}
};

// Sporters
new Float:sRandomSpawns[4][4] = {
{-2321.9980, 223.7286, 36.7851, 182.0423},
{-2289.0681, 173.7864, 35.3056, 90.2348},
{-2323.1501, 190.8897, 35.4063, 312.6801},
{-2309.4375, 158.9597, 35.3125, 0.6440}
};

// Bouncer
new Float:boRandomSpawns[4][4] = {
{-2130.7664, -192.5355, 35.3203, 89.0135},
{-2151.5437, -223.4428, 35.3203, 355.9526},
{-2156.6006, -191.4992, 35.3203, 169.5175},
{-2188.4705, -209.3869, 36.5156, 266.6517}
};

// Mechanic
new Float:meRandomSpawns[4][4] = {
{-2038.1345, 131.1275, 28.8429, 358.2943},
{-2059.7468, 141.9605, 28.8359, 271.5001},
{-2031.3369, 164.7009, 28.8359, 271.8134},
{-2024.4088, 184.7502, 29.3572, 174.3658}
};

// Farmer
new Float:fRandomSpawns[4][4] = {
{-1446.7623, -1543.4193, 101.7578, 356.3998},
{-1421.6044, -1528.0516, 101.7494, 3.1015},
{-1432.4949, -1494.7533, 101.7115, 96.9340},
{-1460.4052, -1487.7290, 101.7578, 267.0522}
};

// Army
new Float:aRandomSpawns[4][4] = {
{-1335.7539, 449.6746, 7.1875, 268.4456},
{-1295.1788, 435.0028, 7.1809, 1.1698},
{-1293.8370, 481.1900, 7.1875, 177.2648},
{-1230.1912, 474.2224, 7.1875, 123.0742}
};

public OnPlayerSpawn(playerid)
{
    if(gSkin[playerid] != -1)
        {
        if(PlayerAcc[playerid][UseSkin] == 1)
            {
            SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
            }
        gSkin[playerid] = GetPlayerSkin(playerid);
        }
    SetPlayerInterior(playerid, 0);
    switch(gSkin[playerid])
        {
        case 147, 150: // Business man/woman spawns
            {
            new rand = random(sizeof(bRandomSpawns));
            SetPlayerPos(playerid, bRandomSpawns[rand][0], bRandomSpawns[rand][1], bRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, bRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x4DC6D6FF);
            }
        case 274, 276, 275: // Medic spawns
            {
            new rand = random(sizeof(mRandomSpawns));
            SetPlayerPos(playerid, mRandomSpawns[rand][0], mRandomSpawns[rand][1], mRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, mRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x65168AFF);
            }
        case 230, 212, 135: // Hobo spawns
            {
            new rand = random(sizeof(hoRandomSpawns));
            SetPlayerPos(playerid, hoRandomSpawns[rand][0], hoRandomSpawns[rand][1], hoRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, hoRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xCC6B4EFF);
            }
        case 280, 282, 281: // Police spawns
            {
            new rand = random(sizeof(pRandomSpawns));
            SetPlayerPos(playerid, pRandomSpawns[rand][0], pRandomSpawns[rand][1], pRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, pRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFFAE00FF);
            }
        case 23, 81, 96: // Sporters spawns
            {
            new rand = random(sizeof(sRandomSpawns));
            SetPlayerPos(playerid, sRandomSpawns[rand][0], sRandomSpawns[rand][1], sRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, sRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFF1E00FF);
            }
        case 163, 164, 165: // Bouncer spawns
            {
            new rand = random(sizeof(boRandomSpawns));
            SetPlayerPos(playerid, boRandomSpawns[rand][0], boRandomSpawns[rand][1], boRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, boRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xB8A6FFFF);
            }
        case 50: // Mechanic spawns
            {
            new rand = random(sizeof(meRandomSpawns));
            SetPlayerPos(playerid, meRandomSpawns[rand][0], meRandomSpawns[rand][1], meRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, meRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x6E6969FF);
            }
        case 158, 159, 157: // Farmer spawns
            {
            new rand = random(sizeof(fRandomSpawns));
            SetPlayerPos(playerid, fRandomSpawns[rand][0], fRandomSpawns[rand][1], fRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, fRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x07B00DFF);
            }
        case 287: // Army service spawns
            {
            new rand = random(sizeof(aRandomSpawns));
            SetPlayerPos(playerid, aRandomSpawns[rand][0], aRandomSpawns[rand][1], aRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, aRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        default: // Default spawns
            {
            new rand = random(sizeof(dRandomSpawns));
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, dRandomSpawns[rand][0], dRandomSpawns[rand][1], dRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, dRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        }
    InMinigame[playerid] = 0;
    if(PlayerAcc[playerid][UseSkin] == 1)
        {
        SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
        }
    if(PlayerAcc[playerid][UseColor] == 1)
        {
        SetPlayerColor(playerid, PlayerAcc[playerid][SaveColor]);
        }
    if(IsSpecing[playerid] == 1)
        {
        SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
        SetPlayerInterior(playerid, Inter[playerid]);
        SetPlayerVirtualWorld(playerid, vWorld[playerid]);
        IsSpecing[playerid] = 0;
        IsBeingSpeced[spectatorid[playerid]] = 0;
        }
    if(PlayerAcc[playerid][Jail] == 1)
        {
        ResetPlayerWeapons(playerid);
        SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
        SetPlayerInterior(playerid, 3);
        SendClientMessage(playerid, COLOR_RED, "** You are back in the PlanetS Jail! Your previsious punishment was not finished.");
        }
    if(PlayerAcc[playerid][Mute] == 1)
        {
        MuteTimer[playerid] = SetTimerEx("OnPlayerUnmute", PlayerAcc[playerid][MuteTime], false, "d", playerid);
        SendClientMessage(playerid, COLOR_RED, "** You have been automatically muted. Because your previsious punishment was not finished.");
        }
    return 1;
}
Reply
#2

Try this, do not forget to make a back up of your code.

Код:
new Float:dRandomSpawns[4][4] = {
{-2721.3625,-317.9877,7.8438,43.9661},
{-2759.6143,-342.8159,7.1797,272.3415},
{-2719.3250,-278.6085,7.1875,181.4974},
{-2800.4924,-309.4407,7.1875,261.6881}
};
// Business man/woman
new Float:bRandomSpawns[4][4] = {
{-2643.1094, 1382.2068, 7.1754, 177.7266},
{-2612.9094, 1353.9767, 7.1578, 88.1124},
{-2656.9878, 1349.4407, 7.0531, 268.5707},
{-2641.0459, 1329.4741, 7.1953, 358.1848}
};

// Medic
new Float:mRandomSpawns[4][4] = {
{-2641.4456, 634.5406, 14.4531, 179.1237},
{-2670.9009, 616.7023, 14.4545, 268.0645},
{-2709.3545, 590.5337, 14.4531, 264.2343},
{-2683.7671, 637.9122, 14.4531, 175.5602}
};

// Hobo
new Float:hoRandomSpawns[4][4] = {
{-1704.9688, 993.6555, 17.9141, 87.4338},
{-1701.9067, 1040.2960, 17.9141, 180.8080},
{-1722.2537, 1040.2469, 17.9141, 175.4579},
{-1738.4052, 1003.7330, 17.9141, 272.2788}
};

// Police
new Float:pRandomSpawns[4][4] = {
{-1616.0428, 685.9863, 7.1875, 176.7121},
{-1639.1235, 674.6732, 7.1875, 260.9996},
{-1693.4172, 693.3384, 30.1838, 310.1934},
{-1621.6307, 677.7749, -4.9063, 269.1230}
};

// Sporters
new Float:sRandomSpawns[4][4] = {
{-2321.9980, 223.7286, 36.7851, 182.0423},
{-2289.0681, 173.7864, 35.3056, 90.2348},
{-2323.1501, 190.8897, 35.4063, 312.6801},
{-2309.4375, 158.9597, 35.3125, 0.6440}
};

// Bouncer
new Float:boRandomSpawns[4][4] = {
{-2130.7664, -192.5355, 35.3203, 89.0135},
{-2151.5437, -223.4428, 35.3203, 355.9526},
{-2156.6006, -191.4992, 35.3203, 169.5175},
{-2188.4705, -209.3869, 36.5156, 266.6517}
};

// Mechanic
new Float:meRandomSpawns[4][4] = {
{-2038.1345, 131.1275, 28.8429, 358.2943},
{-2059.7468, 141.9605, 28.8359, 271.5001},
{-2031.3369, 164.7009, 28.8359, 271.8134},
{-2024.4088, 184.7502, 29.3572, 174.3658}
};

// Farmer
new Float:fRandomSpawns[4][4] = {
{-1446.7623, -1543.4193, 101.7578, 356.3998},
{-1421.6044, -1528.0516, 101.7494, 3.1015},
{-1432.4949, -1494.7533, 101.7115, 96.9340},
{-1460.4052, -1487.7290, 101.7578, 267.0522}
};

// Army
new Float:aRandomSpawns[4][4] = {
{-1335.7539, 449.6746, 7.1875, 268.4456},
{-1295.1788, 435.0028, 7.1809, 1.1698},
{-1293.8370, 481.1900, 7.1875, 177.2648},
{-1230.1912, 474.2224, 7.1875, 123.0742}
};

public OnPlayerSpawn(playerid)
{
    if(gSkin[playerid] != -1)
        {
        if(PlayerAcc[playerid][UseSkin] == 1)
            {
            SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
            }
        gSkin[playerid] = GetPlayerSkin(playerid);
        }
    SetPlayerInterior(playerid, 0);
    switch(gSkin[playerid])
        {
        case 147, 150: // Business man/woman spawns
            {
            new rand1 = random(sizeof(bRandomSpawns));
            SetPlayerPos(playerid, bRandomSpawns[rand][0], bRandomSpawns[rand][1], bRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, bRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x4DC6D6FF);
            }
        case 274, 276, 275: // Medic spawns
            {
            new rand2 = random(sizeof(mRandomSpawns));
            SetPlayerPos(playerid, mRandomSpawns[rand][0], mRandomSpawns[rand][1], mRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, mRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x65168AFF);
            }
        case 230, 212, 135: // Hobo spawns
            {
            new rand3 = random(sizeof(hoRandomSpawns));
            SetPlayerPos(playerid, hoRandomSpawns[rand][0], hoRandomSpawns[rand][1], hoRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, hoRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xCC6B4EFF);
            }
        case 280, 282, 281: // Police spawns
            {
            new rand4 = random(sizeof(pRandomSpawns));
            SetPlayerPos(playerid, pRandomSpawns[rand][0], pRandomSpawns[rand][1], pRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, pRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFFAE00FF);
            }
        case 23, 81, 96: // Sporters spawns
            {
            new rand5 = random(sizeof(sRandomSpawns));
            SetPlayerPos(playerid, sRandomSpawns[rand][0], sRandomSpawns[rand][1], sRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, sRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFF1E00FF);
            }
        case 163, 164, 165: // Bouncer spawns
            {
            new rand6 = random(sizeof(boRandomSpawns));
            SetPlayerPos(playerid, boRandomSpawns[rand][0], boRandomSpawns[rand][1], boRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, boRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xB8A6FFFF);
            }
        case 50: // Mechanic spawns
            {
            new rand7 = random(sizeof(meRandomSpawns));
            SetPlayerPos(playerid, meRandomSpawns[rand][0], meRandomSpawns[rand][1], meRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, meRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x6E6969FF);
            }
        case 158, 159, 157: // Farmer spawns
            {
            new rand8 = random(sizeof(fRandomSpawns));
            SetPlayerPos(playerid, fRandomSpawns[rand][0], fRandomSpawns[rand][1], fRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, fRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x07B00DFF);
            }
        case 287: // Army service spawns
            {
            new rand9 = random(sizeof(aRandomSpawns));
            SetPlayerPos(playerid, aRandomSpawns[rand][0], aRandomSpawns[rand][1], aRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, aRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        default: // Default spawns
            {
            new rand10 = random(sizeof(dRandomSpawns));
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, dRandomSpawns[rand][0], dRandomSpawns[rand][1], dRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, dRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        }
    InMinigame[playerid] = 0;
    if(PlayerAcc[playerid][UseSkin] == 1)
        {
        SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
        }
    if(PlayerAcc[playerid][UseColor] == 1)
        {
        SetPlayerColor(playerid, PlayerAcc[playerid][SaveColor]);
        }
    if(IsSpecing[playerid] == 1)
        {
        SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
        SetPlayerInterior(playerid, Inter[playerid]);
        SetPlayerVirtualWorld(playerid, vWorld[playerid]);
        IsSpecing[playerid] = 0;
        IsBeingSpeced[spectatorid[playerid]] = 0;
        }
    if(PlayerAcc[playerid][Jail] == 1)
        {
        ResetPlayerWeapons(playerid);
        SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
        SetPlayerInterior(playerid, 3);
        SendClientMessage(playerid, COLOR_RED, "** You are back in the PlanetS Jail! Your previsious punishment was not finished.");
        }
    if(PlayerAcc[playerid][Mute] == 1)
        {
        MuteTimer[playerid] = SetTimerEx("OnPlayerUnmute", PlayerAcc[playerid][MuteTime], false, "d", playerid);
        SendClientMessage(playerid, COLOR_RED, "** You have been automatically muted. Because your previsious punishment was not finished.");
        }
    return 1;
}
Reply
#3

What does 'rand' mean??
Reply
#4

new rand3 = random(sizeof(hoRandomSpawns)); your prob is here....
Reply
#5

Ooh rand2 for Medics, rand3 for hobo, rand4 for blabla etc?
Reply
#6

Why don't you try it and inform me about the results first? I will explain you all things after sometime.
Reply
#7

I tried what you send me. But I got a lot of errors:

pawn Код:
D:\[Euro] Server 8\pawno\psadminsystem.pwn(727) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(728) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(726) : warning 204: symbol is assigned a value that is never used: "rand1"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(735) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(736) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(734) : warning 204: symbol is assigned a value that is never used: "rand2"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(743) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(744) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(742) : warning 204: symbol is assigned a value that is never used: "rand3"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(751) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(752) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(750) : warning 204: symbol is assigned a value that is never used: "rand4"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(759) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(760) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(758) : warning 204: symbol is assigned a value that is never used: "rand5"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(767) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(768) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(766) : warning 204: symbol is assigned a value that is never used: "rand6"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(775) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(776) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(774) : warning 204: symbol is assigned a value that is never used: "rand7"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(783) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(784) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(782) : warning 204: symbol is assigned a value that is never used: "rand8"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(791) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(792) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(790) : warning 204: symbol is assigned a value that is never used: "rand9"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(800) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(801) : error 017: undefined symbol "rand"
D:\[Euro] Server 8\pawno\psadminsystem.pwn(798) : warning 204: symbol is assigned a value that is never used: "rand10"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


20 Errors.
Reply
#8

pawn Код:
new Float:dRandomSpawns[4][4] = {
{-2721.3625,-317.9877,7.8438,43.9661},
{-2759.6143,-342.8159,7.1797,272.3415},
{-2719.3250,-278.6085,7.1875,181.4974},
{-2800.4924,-309.4407,7.1875,261.6881}
};
// Business man/woman
new Float:bRandomSpawns[4][4] = {
{-2643.1094, 1382.2068, 7.1754, 177.7266},
{-2612.9094, 1353.9767, 7.1578, 88.1124},
{-2656.9878, 1349.4407, 7.0531, 268.5707},
{-2641.0459, 1329.4741, 7.1953, 358.1848}
};

// Medic
new Float:mRandomSpawns[4][4] = {
{-2641.4456, 634.5406, 14.4531, 179.1237},
{-2670.9009, 616.7023, 14.4545, 268.0645},
{-2709.3545, 590.5337, 14.4531, 264.2343},
{-2683.7671, 637.9122, 14.4531, 175.5602}
};

// Hobo
new Float:hoRandomSpawns[4][4] = {
{-1704.9688, 993.6555, 17.9141, 87.4338},
{-1701.9067, 1040.2960, 17.9141, 180.8080},
{-1722.2537, 1040.2469, 17.9141, 175.4579},
{-1738.4052, 1003.7330, 17.9141, 272.2788}
};

// Police
new Float:pRandomSpawns[4][4] = {
{-1616.0428, 685.9863, 7.1875, 176.7121},
{-1639.1235, 674.6732, 7.1875, 260.9996},
{-1693.4172, 693.3384, 30.1838, 310.1934},
{-1621.6307, 677.7749, -4.9063, 269.1230}
};

// Sporters
new Float:sRandomSpawns[4][4] = {
{-2321.9980, 223.7286, 36.7851, 182.0423},
{-2289.0681, 173.7864, 35.3056, 90.2348},
{-2323.1501, 190.8897, 35.4063, 312.6801},
{-2309.4375, 158.9597, 35.3125, 0.6440}
};

// Bouncer
new Float:boRandomSpawns[4][4] = {
{-2130.7664, -192.5355, 35.3203, 89.0135},
{-2151.5437, -223.4428, 35.3203, 355.9526},
{-2156.6006, -191.4992, 35.3203, 169.5175},
{-2188.4705, -209.3869, 36.5156, 266.6517}
};

// Mechanic
new Float:meRandomSpawns[4][4] = {
{-2038.1345, 131.1275, 28.8429, 358.2943},
{-2059.7468, 141.9605, 28.8359, 271.5001},
{-2031.3369, 164.7009, 28.8359, 271.8134},
{-2024.4088, 184.7502, 29.3572, 174.3658}
};

// Farmer
new Float:fRandomSpawns[4][4] = {
{-1446.7623, -1543.4193, 101.7578, 356.3998},
{-1421.6044, -1528.0516, 101.7494, 3.1015},
{-1432.4949, -1494.7533, 101.7115, 96.9340},
{-1460.4052, -1487.7290, 101.7578, 267.0522}
};

// Army
new Float:aRandomSpawns[4][4] = {
{-1335.7539, 449.6746, 7.1875, 268.4456},
{-1295.1788, 435.0028, 7.1809, 1.1698},
{-1293.8370, 481.1900, 7.1875, 177.2648},
{-1230.1912, 474.2224, 7.1875, 123.0742}
};

public OnPlayerSpawn(playerid)
{
    if(gSkin[playerid] != -1)
        {
        if(PlayerAcc[playerid][UseSkin] == 1)
            {
            SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
            }
        gSkin[playerid] = GetPlayerSkin(playerid);
        }
    SetPlayerInterior(playerid, 0);
    switch(gSkin[playerid])
        {
        case 147, 150: // Business man/woman spawns
            {
            new rand1 = random(sizeof(bRandomSpawns));
            SetPlayerPos(playerid, bRandomSpawns[rand][0], bRandomSpawns[rand][1], bRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, bRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x4DC6D6FF);
            }
        case 274..275: // Medic spawns
            {
            new rand2 = random(sizeof(mRandomSpawns));
            SetPlayerPos(playerid, mRandomSpawns[rand2][0], mRandomSpawns[rand2][1], mRandomSpawns[rand2][2]);
            SetPlayerFacingAngle(playerid, mRandomSpawns[rand2][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x65168AFF);
            }
        case 230, 212, 135: // Hobo spawns
            {
            new rand3 = random(sizeof(hoRandomSpawns));
            SetPlayerPos(playerid, hoRandomSpawns[rand][0], hoRandomSpawns[rand][1], hoRandomSpawns[rand][2]);
            SetPlayerFacingAngle(playerid, hoRandomSpawns[rand][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xCC6B4EFF);
            }
        case 280, 282, 281: // Police spawns
            {
            new rand4 = random(sizeof(pRandomSpawns));
            SetPlayerPos(playerid, pRandomSpawns[rand4][0], pRandomSpawns[rand4][1], pRandomSpawns[rand4][2]);
            SetPlayerFacingAngle(playerid, pRandomSpawns[rand4][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFFAE00FF);
            }
        case 23, 81, 96: // Sporters spawns
            {
            new rand5 = random(sizeof(sRandomSpawns));
            SetPlayerPos(playerid, sRandomSpawns[rand5][0], sRandomSpawns[rand5][1], sRandomSpawns[rand5][2]);
            SetPlayerFacingAngle(playerid, sRandomSpawns[rand5][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFF1E00FF);
            }
        case 163, 164, 165: // Bouncer spawns
            {
            new rand6 = random(sizeof(boRandomSpawns));
            SetPlayerPos(playerid, boRandomSpawns[rand6][0], boRandomSpawns[rand6][1], boRandomSpawns[rand6][2]);
            SetPlayerFacingAngle(playerid, boRandomSpawns[rand6][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xB8A6FFFF);
            }
        case 50: // Mechanic spawns
            {
            new rand7 = random(sizeof(meRandomSpawns));
            SetPlayerPos(playerid, meRandomSpawns[rand7][0], meRandomSpawns[rand7][1], meRandomSpawns[rand7][2]);
            SetPlayerFacingAngle(playerid, meRandomSpawns[rand7][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x6E6969FF);
            }
        case 158.. 157: // Farmer spawns
            {
            new rand8 = random(sizeof(fRandomSpawns));
            SetPlayerPos(playerid, fRandomSpawns[rand8][0], fRandomSpawns[rand8][1], fRandomSpawns[rand8][2]);
            SetPlayerFacingAngle(playerid, fRandomSpawns[rand8][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x07B00DFF);
            }
        case 287: // Army service spawns
            {
            new rand9 = random(sizeof(aRandomSpawns));
            SetPlayerPos(playerid, aRandomSpawns[rand9][0], aRandomSpawns[rand9][1], aRandomSpawns[rand9][2]);
            SetPlayerFacingAngle(playerid, aRandomSpawns[rand9][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        default: // Default spawns
            {
            new rand10 = random(sizeof(dRandomSpawns));
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, dRandomSpawns[rand10][0], dRandomSpawns[rand10][1], dRandomSpawns[rand10][2]);
            SetPlayerFacingAngle(playerid, dRandomSpawns[rand10][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        }
    InMinigame[playerid] = 0;
    if(PlayerAcc[playerid][UseSkin] == 1)
        {
        SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
        }
    if(PlayerAcc[playerid][UseColor] == 1)
        {
        SetPlayerColor(playerid, PlayerAcc[playerid][SaveColor]);
        }
    if(IsSpecing[playerid] == 1)
        {
        SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
        SetPlayerInterior(playerid, Inter[playerid]);
        SetPlayerVirtualWorld(playerid, vWorld[playerid]);
        IsSpecing[playerid] = 0;
        IsBeingSpeced[spectatorid[playerid]] = 0;
        }
    if(PlayerAcc[playerid][Jail] == 1)
        {
        ResetPlayerWeapons(playerid);
        SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
        SetPlayerInterior(playerid, 3);
        SendClientMessage(playerid, COLOR_RED, "** You are back in the PlanetS Jail! Your previsious punishment was not finished.");
        }
    if(PlayerAcc[playerid][Mute] == 1)
        {
        MuteTimer[playerid] = SetTimerEx("OnPlayerUnmute", PlayerAcc[playerid][MuteTime], false, "d", playerid);
        SendClientMessage(playerid, COLOR_RED, "** You have been automatically muted. Because your previsious punishment was not finished.");
        }
    return 1;
}
This should work, the problem was you declared random variables without using them to your function take a look at script and you'll understand.
Reply
#9

Try this.It will work

Код:
new Float:dRandomSpawns[4][4] = {
{-2721.3625,-317.9877,7.8438,43.9661},
{-2759.6143,-342.8159,7.1797,272.3415},
{-2719.3250,-278.6085,7.1875,181.4974},
{-2800.4924,-309.4407,7.1875,261.6881}
};
// Business man/woman
new Float:bRandomSpawns[4][4] = {
{-2643.1094, 1382.2068, 7.1754, 177.7266},
{-2612.9094, 1353.9767, 7.1578, 88.1124},
{-2656.9878, 1349.4407, 7.0531, 268.5707},
{-2641.0459, 1329.4741, 7.1953, 358.1848}
};

// Medic
new Float:mRandomSpawns[4][4] = {
{-2641.4456, 634.5406, 14.4531, 179.1237},
{-2670.9009, 616.7023, 14.4545, 268.0645},
{-2709.3545, 590.5337, 14.4531, 264.2343},
{-2683.7671, 637.9122, 14.4531, 175.5602}
};

// Hobo
new Float:hoRandomSpawns[4][4] = {
{-1704.9688, 993.6555, 17.9141, 87.4338},
{-1701.9067, 1040.2960, 17.9141, 180.8080},
{-1722.2537, 1040.2469, 17.9141, 175.4579},
{-1738.4052, 1003.7330, 17.9141, 272.2788}
};

// Police
new Float:pRandomSpawns[4][4] = {
{-1616.0428, 685.9863, 7.1875, 176.7121},
{-1639.1235, 674.6732, 7.1875, 260.9996},
{-1693.4172, 693.3384, 30.1838, 310.1934},
{-1621.6307, 677.7749, -4.9063, 269.1230}
};

// Sporters
new Float:sRandomSpawns[4][4] = {
{-2321.9980, 223.7286, 36.7851, 182.0423},
{-2289.0681, 173.7864, 35.3056, 90.2348},
{-2323.1501, 190.8897, 35.4063, 312.6801},
{-2309.4375, 158.9597, 35.3125, 0.6440}
};

// Bouncer
new Float:boRandomSpawns[4][4] = {
{-2130.7664, -192.5355, 35.3203, 89.0135},
{-2151.5437, -223.4428, 35.3203, 355.9526},
{-2156.6006, -191.4992, 35.3203, 169.5175},
{-2188.4705, -209.3869, 36.5156, 266.6517}
};

// Mechanic
new Float:meRandomSpawns[4][4] = {
{-2038.1345, 131.1275, 28.8429, 358.2943},
{-2059.7468, 141.9605, 28.8359, 271.5001},
{-2031.3369, 164.7009, 28.8359, 271.8134},
{-2024.4088, 184.7502, 29.3572, 174.3658}
};

// Farmer
new Float:fRandomSpawns[4][4] = {
{-1446.7623, -1543.4193, 101.7578, 356.3998},
{-1421.6044, -1528.0516, 101.7494, 3.1015},
{-1432.4949, -1494.7533, 101.7115, 96.9340},
{-1460.4052, -1487.7290, 101.7578, 267.0522}
};

// Army
new Float:aRandomSpawns[4][4] = {
{-1335.7539, 449.6746, 7.1875, 268.4456},
{-1295.1788, 435.0028, 7.1809, 1.1698},
{-1293.8370, 481.1900, 7.1875, 177.2648},
{-1230.1912, 474.2224, 7.1875, 123.0742}
};

public OnPlayerSpawn(playerid)
{
    if(gSkin[playerid] != -1)
        {
        if(PlayerAcc[playerid][UseSkin] == 1)
            {
            SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
            }
        gSkin[playerid] = GetPlayerSkin(playerid);
        }
    SetPlayerInterior(playerid, 0);
    switch(gSkin[playerid])
        {
        case 147, 150: // Business man/woman spawns
            {
            new rand1 = random(sizeof(bRandomSpawns));
            SetPlayerPos(playerid, bRandomSpawns[rand1][0], bRandomSpawns[rand1][1], bRandomSpawns[rand1][2]);
            SetPlayerFacingAngle(playerid, bRandomSpawns[rand1][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x4DC6D6FF);
            }
        case 274, 276, 275: // Medic spawns
            {
            new rand2 = random(sizeof(mRandomSpawns));
            SetPlayerPos(playerid, mRandomSpawns[rand2][0], mRandomSpawns[rand2][1], mRandomSpawns[rand2][2]);
            SetPlayerFacingAngle(playerid, mRandomSpawns[rand2][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x65168AFF);
            }
        case 230, 212, 135: // Hobo spawns
            {
            new rand3 = random(sizeof(hoRandomSpawns));
            SetPlayerPos(playerid, hoRandomSpawns[rand3][0], hoRandomSpawns[rand3][1], hoRandomSpawns[rand3][2]);
            SetPlayerFacingAngle(playerid, hoRandomSpawns[rand3][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xCC6B4EFF);
            }
        case 280, 282, 281: // Police spawns
            {
            new rand4 = random(sizeof(pRandomSpawns));
            SetPlayerPos(playerid, pRandomSpawns[rand4][0], pRandomSpawns[rand4][1], pRandomSpawns[rand4][2]);
            SetPlayerFacingAngle(playerid, pRandomSpawns[rand4][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFFAE00FF);
            }
        case 23, 81, 96: // Sporters spawns
            {
            new rand5 = random(sizeof(sRandomSpawns));
            SetPlayerPos(playerid, sRandomSpawns[rand5][0], sRandomSpawns[rand5][1], sRandomSpawns[rand5][2]);
            SetPlayerFacingAngle(playerid, sRandomSpawns[rand5][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xFF1E00FF);
            }
        case 163, 164, 165: // Bouncer spawns
            {
            new rand6 = random(sizeof(boRandomSpawns));
            SetPlayerPos(playerid, boRandomSpawns[rand6][0], boRandomSpawns[rand6][1], boRandomSpawns[rand6][2]);
            SetPlayerFacingAngle(playerid, boRandomSpawns[rand6][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0xB8A6FFFF);
            }
        case 50: // Mechanic spawns
            {
            new rand7 = random(sizeof(meRandomSpawns));
            SetPlayerPos(playerid, meRandomSpawns[rand7][0], meRandomSpawns[rand7][1], meRandomSpawns[rand7][2]);
            SetPlayerFacingAngle(playerid, meRandomSpawns[rand7][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x6E6969FF);
            }
        case 158, 159, 157: // Farmer spawns
            {
            new rand8 = random(sizeof(fRandomSpawns));
            SetPlayerPos(playerid, fRandomSpawns[rand8][0], fRandomSpawns[rand8][1], fRandomSpawns[rand8][2]);
            SetPlayerFacingAngle(playerid, fRandomSpawns[rand8][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x07B00DFF);
            }
        case 287: // Army service spawns
            {
            new rand9 = random(sizeof(aRandomSpawns));
            SetPlayerPos(playerid, aRandomSpawns[rand9][0], aRandomSpawns[rand9][1], aRandomSpawns[rand9][2]);
            SetPlayerFacingAngle(playerid, aRandomSpawns[rand9][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        default: // Default spawns
            {
            new rand10 = random(sizeof(dRandomSpawns));
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, dRandomSpawns[rand10][0], dRandomSpawns[rand10][1], dRandomSpawns[rand10][2]);
            SetPlayerFacingAngle(playerid, dRandomSpawns[rand10][3]);
            SetCameraBehindPlayer(playerid);
            SetPlayerColor(playerid, 0x23873CFF);
            }
        }
    InMinigame[playerid] = 0;
    if(PlayerAcc[playerid][UseSkin] == 1)
        {
        SetPlayerSkin(playerid, PlayerAcc[playerid][SaveSkin]);
        }
    if(PlayerAcc[playerid][UseColor] == 1)
        {
        SetPlayerColor(playerid, PlayerAcc[playerid][SaveColor]);
        }
    if(IsSpecing[playerid] == 1)
        {
        SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
        SetPlayerInterior(playerid, Inter[playerid]);
        SetPlayerVirtualWorld(playerid, vWorld[playerid]);
        IsSpecing[playerid] = 0;
        IsBeingSpeced[spectatorid[playerid]] = 0;
        }
    if(PlayerAcc[playerid][Jail] == 1)
        {
        ResetPlayerWeapons(playerid);
        SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
        SetPlayerInterior(playerid, 3);
        SendClientMessage(playerid, COLOR_RED, "** You are back in the PlanetS Jail! Your previsious punishment was not finished.");
        }
    if(PlayerAcc[playerid][Mute] == 1)
        {
        MuteTimer[playerid] = SetTimerEx("OnPlayerUnmute", PlayerAcc[playerid][MuteTime], false, "d", playerid);
        SendClientMessage(playerid, COLOR_RED, "** You have been automatically muted. Because your previsious punishment was not finished.");
        }
    return 1;
}
Reply
#10

I still spawn at the business man and woman location with the other skins ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)