10.06.2014, 11:50
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?
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;
}