dm spawn
#1

how to make DM and after you die you will respawn at DM

my gm:
https://sampforum.blast.hk/showthread.php?tid=497129


it has dm map
Reply
#2

Please explain in more detail. Thank you
Reply
#3

You can set the spawn position after dieing though you have to check with a variable if the player died at the dm zone ,just die randomly (example) or he is just spawning as OnPlayerDeath calls directly OnPlayerSpawn's callback
Reply
#4

You need to use the OnPlayerSpawn callback, players that spawn or respawn will be passed through this function.

You could then use the SetSpawnInfo function or various others to achieve your goal (I believe the SetSpawnInfo is safer than the others but I personally haven't been using it much and haven't had any issues with setting position, skin etc seperately).

https://sampwiki.blast.hk/wiki/SetSpawnInfo
Reply
#5

i want Respawn at same place after death

how to make it
Reply
#6

Save the position of the player when they die, load it when they respawn, something like this:

Код:
public OnPlayerDeath(playerid)
{
	new Float:pos[3];
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	SetPVarFloat(playerid,"PosX",pos[0]);
	SetPVarFloat(playerid,"PosY",pos[1]);
	SetPVarFloat(playerid,"PosZ",pos[2]);
	SetPVarInt(playerid,"IsResPawn",1);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(GetPVarInt(playerid,"IsResPawn") == 1)
	{
		SetPlayerPos(playerid,GetPVarFloat(playerid,"PosX"),GetPVarFloat(playerid,"PosY"),GetPVarFloat(playerid,"PosZ");
		DeletePVar(playerid,"IsResPawn");
	}
	return 1;
}
While it may not be the most optimized code, it should work.

Here's a tutorial about PVars (what we used in the code up here) https://sampforum.blast.hk/showthread.php?tid=163175

Here's a wiki page with nice documentation for starters https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#7

how to make it to respawn
Reply
#8

PHP код:
  if(CurrentMenu == dm)
        {
    switch(
row)
    {
        case 
0:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid26999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1127.9473, -1446.757415.7968);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 1 (SAWNOFF)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
1:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid29999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2508.37862786.636910.8203);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 2 (MP5)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
2:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid32999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1445.934, -1064.5279213.3827);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 3 (TEC9)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
3:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid27999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -924.254, -498.031126.7656);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 4(CombatShotgun)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
4:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid31999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -2129.3096, -444.273235.5344);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 5(M4)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
5:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid28999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1315.9521, -987.8052148.6437);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 6(MicroUzi)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
6:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid30999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid214.58381875.321817.6406);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 7(AK47)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
7:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerInterior(playerid5);
        
SetPlayerPos(playerid761.607711.03991001.1638);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 8 (Boks)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
8:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid33999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2276.28461070.207810.8203);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 9 (Rifle)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
9:
        {
        
ShowMenuForPlayer(teleportplayerid);
        }
    }
    }
    if(
CurrentMenu == dm2)
        {
    switch(
row)
    {
        case 
0:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid26999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2256.15111081.482133.5284);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 10(SAWNOFF2)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
1:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid31999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1470.9282382.742730.0858);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 11(M4)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
2:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid25999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1596.9136149.0782, -10.8312);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 12(Shotgun)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
                }
        case 
3:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid24999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid260.59792898.85378.9909);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 13(DesertEagle)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
4:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid30999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -273.96982353.0808109.2238);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 14(AK47)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
5:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid91);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -924.05692675.658642.3703);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 15(Dildo)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
6:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid34999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1288.9788,2504.3210,86.9994);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 16(Sniper)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
7:
        {
            
ShowMenuForPlayer(teleportplayerid);
        }
    }
    }
    return 
1;

how to respawn after die until leave the map
Reply
#9

my gamemode

https://sampforum.blast.hk/showthread.php?tid=497129


it has dm map but cannot respawn back after death

how to make respawn back after death

PHP код:
if(CurrentMenu == dm)
        {
    switch(
row)
    {
        case 
0:
        {

        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid26999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1127.9473, -1446.757415.7968);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 1 (SAWNOFF)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
1:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid29999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2508.37862786.636910.8203);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 2 (MP5)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
2:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid32999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1445.934, -1064.5279213.3827);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 3 (TEC9)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
3:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid27999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -924.254, -498.031126.7656);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 4(CombatShotgun)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
4:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid31999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -2129.3096, -444.273235.5344);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 5(M4)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
5:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid28999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid1315.9521, -987.8052148.6437);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 6(MicroUzi)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
6:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid30999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid214.58381875.321817.6406);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 7(AK47)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
7:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerInterior(playerid5);
        
SetPlayerPos(playerid761.607711.03991001.1638);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 8 (Boks)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
8:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid33999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2276.28461070.207810.8203);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 9 (Rifle)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
9:
        {
        
ShowMenuForPlayer(teleportplayerid);
        }
    }
    }
    if(
CurrentMenu == dm2)
        {
    switch(
row)
    {
        case 
0:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid26999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid2256.15111081.482133.5284);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 10(SAWNOFF2)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
1:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid31999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1470.9282382.742730.0858);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 11(M4)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
2:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid25999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1596.9136149.0782, -10.8312);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 12(Shotgun)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
                }
        case 
3:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid24999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid260.59792898.85378.9909);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 13(DesertEagle)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
4:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid30999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -273.96982353.0808109.2238);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 14(AK47)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
5:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid91);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -924.05692675.658642.3703);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 15(Dildo)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
6:
        {
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0);
        
GivePlayerWeapon(playerid34999);
        
SetPlayerHealth(playerid100.0);
        
SetPlayerPos(playerid, -1288.9788,2504.3210,86.9994);
        
GetPlayerName(playeridvar025);
        
format(var1256">>%s has teleported to deathmatch 16(Sniper)."var0);
        
SendClientMessageToAll(0xFF9900AAvar1);
        
TogglePlayerControllable(playerid,1);
        }
        case 
7:
        {
            
ShowMenuForPlayer(teleportplayerid);
        }
    }
    }
    return 
1;

the map

p.sorry bad english
Reply
#10

or how to teach me how to make it

i search all topic about dm but i cannot understand
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)