respawn
#1

Hello, I use /DM and i play in DM and when i dead i respawn out of "DM"
can someone tell me the code: when someone killed in 'DM' he should respawn in deathmatch again,,,,,,,
Reply
#2

When a player joins in DM, set a variable to 1 and when they leave, set it to 0. In OnPlayerSpawn, check if the variable is 1 and set the player's position in the DM arena else to the normal spawnpoints.
Reply
#3

Код:
CMD:moltdm(playerid, params[])
{
	new str[128];
	if(UseDrug[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: Cannot teleport, Current using drugs!");
	if(GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3 && GetPlayerState(playerid) != 7)
	return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You must be spawned, To use this command!");
	if(pInfo[playerid][Jail] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are in jail, You cannot teleport!");
	if(InP[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in Parkour!");
	if(InHouse[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are inside the House, Cannot teleport!");
	if(InDM[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot teleport, You're in DM!");
	if(God[playerid][0] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot go to TDM/DM during your God Protection is on, Please try again when it's off!");
	if(pInfo[playerid][Freeze] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are frozen, Cannot use this command!");
	if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot teleport while in Passenger seat!");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error]: You must be out of the vehicle before teleporting!");
	timer[playerid][3] = SetTimerEx("LoadedObjects", 5000, false, "i", playerid);
	timer[playerid][4] = SetTimerEx("Protection", 4000, false, "i", playerid);
	new rand = random(sizeof(gRandomSpawns3));
	SetCameraBehindPlayer(playerid);
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid, gRandomSpawns3[rand][PlayerX], gRandomSpawns3[rand][PlayerY], gRandomSpawns3[rand][PlayerZ]);
	SetPlayerFacingAngle(playerid, gRandomSpawns3[rand][PlayerAngle]);
	ResetPlayerWeapons(playerid);
	GivePlayerWeapon(playerid, 18, 99999);
    TextDrawHideForPlayer(playerid, Textdraw5);
    TextDrawHideForPlayer(playerid, Textdraw4);
	SetPlayerArmour(playerid, 0.0);
	if(pInfo[playerid][VIP] >= 1) SetPlayerArmour(playerid, 100.0);
	SetPlayerVirtualWorld(playerid, 47);
	SetPlayerHealth(playerid, INFINITE);
	SendClientMessage(playerid, COLOR_YELLOW, "[LeaveDM]: /leavedm to leave the dm!");
	format(str, sizeof(str), "[DM]: %s(%d) has joined the Molotov Deathmatch (/moltdm)", GetName(playerid), playerid);
	SendClientMessageToAll(COLOR_YELLOW, str);
	SendClientMessage(playerid, COLOR_GREY, "[Protection]: Spawn Protection will end in 4 seconds!");
	InDM[playerid] = 7;
	return 1;
there is no onplayerspawn
Reply
#4

OnPlayerSpawn is a callback - don't search for it in your command!

pawn Код:
public OnPlayerSpawn(playerid)
{
    switch (InDM[playerid])
    {
        case 0:
        {
            // set the normal spawnpoint
        }
        case 7:
        {
            // set the position for the /moltdm
        }
    }
    return 1;
}
Reply
#5

BUMP.
Reply
#6

anyone plz
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
OnPlayerSpawn is a callback - don't search for it in your command!

pawn Код:
public OnPlayerSpawn(playerid)
{
    switch (InDM[playerid])
    {
        case 0:
        {
            // set the normal spawnpoint
        }
        case 7:
        {
            // set the position for the /moltdm
        }
    }
    return 1;
}
Stop bumping !
This is the solution ▲ try it ◀▲▼▶
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)