17.04.2011, 19:58
How can i make when somebody join dm2 to spawn him in random position in the dm and when i kill somebody the player spawn in random position.
How can i make when somebody join dm2 to spawn him in random position in the dm and when i kill somebody the player spawn in random position.
|
OnPlayerDeath(playerid)
{
SetPVarInt(playerid, "ToSpawnAfterDeath", 1);
return 1;
}
OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid) == 1)
{
new rand=random(4)//you can change 4 for the number of positions you have
switch(rand)
{
case 0:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.ґ
case 1:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
case 2:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
case 3:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
}
}
}
OnPlayerDeath(playerid)
{
SetPVarInt(playerid, "ToSpawnAfterDeath", 1);
return 1;
}
OnPlayerSpawn(playerid)
{
new rand=random(4)//you can change 4 for the number of positions you have
switch(rand)
{
case 0:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.ґ
case 1:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
case 2:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
case 3:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
}
}
new Float:RandomSpawn[][4] = {
{X, Y, Z, ANGLE},
{X, Y, Z, ANGLE},
{X, Y, Z, ANGLE}
}
public OnPlayerSpawn(playerid) {
new
rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerInDm[playerid] == 1)
{
switch(random(6)) // Number of positions which the switch will random
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
}
}
return 1;
}