[Tutorial] How to make Deathmatch with respawns after death
#3

If you are not DM you wont respawn at DM
If you are in DM you will respaw at DM

to make random spawns for player

first make the random spawn

pawn Код:
new Float:RandomSpawns[][4] = { // Random spawns for player that not in DM
    {609.7040,-586.5684,17.2266,256.8267},
    {610.3588,-590.8182,17.2266,263.0453},
    {616.1186,-591.2390,17.2330,268.1367}//I will use same position's just to show you how yo make it
    //I will be using 3 you can add more if you want  
};
now if you want to add random spawn + DM spawn
do it like this

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(InDM[playerid] == 1)//This will tell the script to respawn only the players that inside DM
    {
        SetPlayerInterior(playerid, 0); // We will set the interior to 0 (you can change it to your own DM)
        SetPlayerVirtualWorld(playerid, 10); // and we will make the Virtual World in different world, so we wont mix with other players
        new rand = random(sizeof(DMSpawns)); // DM Spawn
        SetPlayerPos(playerid, DMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]);// we will set the player position at DM
        SetPlayerFacingAngle(playerid, DMSpawns[rand][3]); // Also facing Angle
        //and we will give him weapons, I will give 2 weapons
        GivePlayerWeapon(playerid, 24, 1500); // Desert Eagle
        GivePlayerWeapon(playerid, 26, 1500); // Sawnoff Shutgun
        //you can edit them, or add more weapons
    }
    else {
    new rand = random(sizeof(RandomSpawns)); // Ramdom Spawns
    SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);// we will set the player position (Random spawns
    SetPlayerFacingAngle(playerid, RandomSpawns[rand][3]); // Also facing Angle
    }
    return 1;
}
if you don't want the DM spawns and you want only the Random spawn do it like this


pawn Код:
public OnPlayerSpawn(playerid)
{
    new rand = random(sizeof(RandomSpawns)); // Random Spawn
    SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);// we will set  the player position (random spawns)
    SetPlayerFacingAngle(playerid, RandomSpawns[rand][3]); // Also facing Angle
    return 1;
}
It's very simple
Hope you understand
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)