new Float:RandomSpawn[][4] = { {-2796.9854, 1224.8180, 20.5429, 192.0335}, {-2454.2170, 503.8759, 30.0790, 267.2932}, {-2669.7322, -6.0874, 6.1328, 89.8853} };
public OnPlayerSpawn(playerid) { new val = random(sizeof(RandomSpawn)); SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]); SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]); return 1; }
SetPlayerPos(playerid, RandomSpawn[val][0], RandomSpawn[val][1],RandomSpawn[val][2]
SetPlayerFacingAngle(playerid, RandomSpawn[val][3]);
public OnPlayerSpawn(playerid)
{
new val = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[val][0], RandomSpawn[val][1],RandomSpawn[val][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[val][3]);
return 1;
}
today I was working on random spawns for my prison. These spawns are just for prisoners. But, i didnt figure out, how to set random spawn just for specified team. |
public OnPlayerSpawn(playerid)
{
if(GetPlayerTeam(playerid) == 1)
{
new val = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[val][0], RandomSpawn[val][1],RandomSpawn[val][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[val][3]);
}
return 1;
}