07.02.2010, 04:32
Well i learned this from LVDM script
This goes on top of the script, below the #include <a_samp>
If you want to add more positions, just change "new Float:gRandomPlayerSpawns[17][3] = {" the [17] to the number of positions you want, and just add the position with a " }, " and the last one should only be a " } " at the end.
This would be a new "public" thingy so you don't put it in "Public OnPlayerRequestClass" or other public one.

This goes on top of the script, below the #include <a_samp>
If you want to add more positions, just change "new Float:gRandomPlayerSpawns[17][3] = {" the [17] to the number of positions you want, and just add the position with a " }, " and the last one should only be a " } " at the end.
Код:
//new's new iSpawnSet[MAX_PLAYERS]; // forwards forward SetPlayerRandomSpawn(playerid); // new Float:gRandomPlayerSpawns[17][3] = { {1958.3783,1343.1572,15.3746}, {2199.6531,1393.3678,10.8203}, {2483.5977,1222.0825,10.8203}, {2637.2712,1129.2743,11.1797}, {2000.0106,1521.1111,17.0625}, {2024.8190,1917.9425,12.3386}, {2261.9048,2035.9547,10.8203}, {2262.0986,2398.6572,10.8203}, {1598.8419,2221.5676,11.0625}, {1318.7759,1251.3580,10.8203}, {1558.0731,1007.8292,10.8125}, {1705.2347,1025.6808,10.8203}, {1380.7273,-1740.7815,13.5469}, {2280.4670,-1724.4014,13.5469}, {2073.4302,-1762.4957,13.5594}, {1827.6128,-1857.6096,13.5781}, {1210.4469,-2037.1666,69.0078} }; new Float:gCopPlayerSpawns[2][3] = { {2297.1064,2452.0115,10.8203}, {2297.0452,2468.6743,10.8203} };
Код:
//------------------------------------------------------------------------------------------------- public OnPlayerSpawn(playerid) { SetPlayerRandomSpawn(playerid); return 1; } //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- public SetPlayerRandomSpawn(playerid) { if (iSpawnSet[playerid] == 1) { new rand = random(sizeof(gCopPlayerSpawns)); SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); SetPlayerFacingAngle(playerid, 270.0); } else if (iSpawnSet[playerid] == 0) { new rand = random(sizeof(gRandomPlayerSpawns)); SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); } return 1; }