DM spawn after death
#1

I created a DM zone and my problem is that when a player die it spawns it at random spawn positions. I want to spawn again in the the area. How can i do this?
here is my code from the teleport:
pawn Код:
CMD:minigun(playerid, params[])
    {
        if(GetPVarType(playerid, "DMZONE") != 0) return SendClientMessage(playerid, red, "bla bla!(/leavedm)");
        SetPVarInt(playerid, "DMZONE", 1); // set the pvar to show that they're in a DM zone
        if(Teled[playerid] == 1) return SendClientMessage(playerid,red," test...(/leavedm)");
        Teled[playerid] = 1;
        new mR = random(sizeof(MinigunRandom));
        SetPlayerPos(playerid, MinigunRandom[mR][0], MinigunRandom[mR][1], MinigunRandom[mR][2]);
        GameTextForPlayer(playerid, "~w~minigun deathmatch", 4000, 6);
        SetPlayerInterior(playerid, 0);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s joined /minigun", pName);
        SendClientMessageToAll(COLOR_TELEPORT, str);
        SetPlayerInterior(playerid, 0);
        SetPlayerHealth(playerid, 100);
        GivePlayerWeapon(playerid, 38, 99999999);

        return 1;
    }
Reply
#2

Just put this onplayerspawn(playerid);

Код:
SetPlayerPos(playerid, MinigunRandom[mR][0], MinigunRandom[mR][1], MinigunRandom[mR][2]);
SetPlayerInterior(playerid,0);
Reply
#3

But this will spawn him every time there? I want only after death in DM zone
Reply
#4

I think that if player death its called this onplayerspawn so you should make it

or try this

Код:
new death[MAX_PLAYERS]; // up

onplayerconnect()
{
death[playerid] = 0;
}

onplayerdeath(..)
{
death[playerid] = 1;
}

onplayerspawn(..)
{
if(death[playerid] = 1) SetPlayerPos(playerid, MinigunRandom[mR][0], MinigunRandom[mR][1], MinigunRandom[mR][2]);
}
Reply
#5

But i don't want every time when someone dies to teleport him into DM..
Reply
#6

from ur code i can see : Teled[playerid] = 1; is ur variable checking if player in DM

so in SPawn do this:
pawn Код:
if( Teled[playerid] == 1 ) {
//spawn in DM
}
means u need a variable check showing that if player in DM
Reply
#7

yop or this SetPVarInt(playerid, "DMZONE", 1);

use this onplayerspawn if(getpvarint("dmzone") == 1) setplayerpos..
Reply
#8

I understood you all but this var
pawn Код:
Teled[playerid]
is used in many dm zones and if i type this in onplayerspawn, it will teleport him to the place of 1 dm zone. Is there another way of doing this?
Reply
#9

as i said try this onplayerspawn

if(GetPVarInt(playerid,"dmzone") == 1) setplayerpos(your dm)
Reply
#10

Read what i said! If i white this it will spawn him at the coordinates of one teleport only. For example, I have /minigun and /area51 and if the player dies, it will always teleport him to minigun coordinates(if i put them in onplayerspawn). What i have to do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)