[Tutorial] Random spawns
#41

Quote:
Originally Posted by Kenxxx
View Post
What about If I SetPlayerCheckpoint(playerid, RandomSpawn[random][0], RandomSpawn[random][1], RandomSpawn[random][2], 5);
And I wanna get if Player IsPlayerInRangeOfPoint of the random point in SetPlayerCheckpoint what will I do ?
Sorry for my bad English
You're putting a checkpoint RIGHT where the player spawns.
In that case you would want to use OnPlayerEnterCheckpoint
https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint
Reply
#42

i made all this things but not work what i can do
Reply
#43

Quote:
Originally Posted by HumbleGuy
View Post
i made all this things but not work what i can do
Post your code..
Reply
#44

perfecto!, me ayudaste bastante.
Reply
#45

Hello ! Help me with the code! How do i make rondomny spawn both in Cops and Robbers ? That is, the police spvnitsa only on the site, doctors at the hospital and so on! What do I need to register in a public OnPlayerSpawn (playerid)


new Float:CivilianSpawn[18][4] = {
{2022.6539,1007.2164,10.8203,269.9900},
{2177.4451,963.9155,10.8203,359.9802},
{2362.6580,1005.0098,14.2725,91.5136},
{2435.0430,1653.7240,10.8203,178.3609},
{1947.6760,2068.7869,10.8203,89.0601},
{2346.8154,735.3505,11.4683,184.3114},
{2127.4910,2364.1289,10.8203,179.6657},
{1429.1036,-1091.6676,17.5623,186.9590},
{1266.1420,-2009.2614,59.2444,187.8720},
{1671.8055,-1709.1715,20.4844,102.0455},
{2316.8474,-1646.4652,14.8270,185.1704},
{2253.9595,-1777.4771,13.5469,0.6755},
{477.0917,-1514.6082,20.4747,277.2458},
{-2571.2405,1149.4059,55.7266,154.4693},
{-1942.0551,572.1608,35.1719,358.3391},
{-1992.2852,251.0843,35.1719,283.5931},
{-2030.6617,145.9314,28.8359,273.5602},
{-2616.2598,81.0121,4.3435,270.1165}
};

new Float:CopSpawn[6][4] = {
{2238.2151,2449.3613,11.0372,89.4249},
{2294.8032,2451.5522,10.8203,88.8232},
{2294.0479,2468.4722,10.8203,88.7628},
{2250.7517,2490.9146,10.9908,358.5601},
{-1620.6388,682.8951,7.1875,174.1942},
{1548.1506,-1669.6023,13.5669,88.7577}
};

new Float:PrisonSpawn[3][4] = {
{198.6401,161.5331,1003.0300,181.3124},
{193.4779,175.5881,1003.0234,6.5961},
{197.7083,174.6549,1003.0234,0.0787}
};

new Float:SFSpawn[3][4] = {
{1568.0333,-1691.7218,5.8906,183.6940},
{-1593.2145,716.1462,-5.2422,269.8380},
{2267.8535,2448.8921,3.5313,181.4704}
};

new Float:ARMYSpawn[2][4] = {
{-1473.7511,461.7685,7.1809,2.3054},
{239.7829,1859.5490,14.0840,359.0583}
};

new Float:MedicSpawn[3][4] = {
{1177.7314,-1323.7150,14.0852,270.0000},
{-2655.1633,631.4604,14.4531,176.9321},
{1607.5931, 1818.5118, 10.8203,83.20}
};
Reply
#46

Yep under OnPlayerSpawn.
Reply
#47

Quote:
Originally Posted by sanyaretro
View Post
Hello ! Help me with the code! How do i make rondomny spawn both in Cops and Robbers ? That is, the police spvnitsa only on the site, doctors at the hospital and so on! What do I need to register in a public OnPlayerSpawn (playerid)
OnPlayerSpawn

pawn Code:
new rand = random(sizeof(CivilianSpawn));
    SetPlayerPos(playerid, CivilianSpawn[rand][0], CivilianSpawn[rand][1],CivilianSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, CivilianSpawn[rand][3]);
Obviously for doctors, cops etc. you have to add some checks, like if you have gTeam:

pawn Code:
if(gTeam[playerid] == TEAM_COP]
{
    new rand = random(sizeof(CopSpawn));
    SetPlayerPos(playerid, CopSpawn[rand][0], CopSpawn[rand][1],CopSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, CopSpawn[rand][3]);
}
And so on.
Reply


Forum Jump:


Users browsing this thread: 16 Guest(s)