DM help
#1

Can someone make that when player dye in DM it will spawn him on DM random spawns because it spawns me on gamemode random spawn

pawn Код:
#include <a_samp>
#define COLOR_LIGHTBLUE    0x33CCFF19

new String[256];
new InDM[MAX_PLAYERS];
new Float:DMSpawns[][4] = {

{2590.0005,2351.7432,47.4453,60.5416},
{2464.0410,2333.7136,82.7734,5.4178},
{2533.2700,2434.7053,54.0360,184.3093},
{2533.4604,2324.6873,29.4766,287.0836},
{2506.9011,2398.9487,29.4766,176.7892},
{2601.4460,2388.3093,19.8577,129.8120},
{2535.9763,2424.7126,14.0379,170.8592}

};

public OnPlayerConnect(playerid)
{
InDM[playerid] = 0;
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
InDM[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(InDM[playerid] == 1)
{
SetPlayerInterior(playerid, 0);
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
GivePlayerWeapon(playerid, 34, 1500); // Sniper

}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sniper", cmdtext, true, 4) == 0)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(InDM[playerid] == 0)
{
InDM[playerid] = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE , "You have joined /sniper, to leave type /sniper again");//Message to tell him that he joined DM
format(String, sizeof(String), "Server:{FFFFFF}%s(%d) has joined SniperDM(/sniper)", PlayerName, playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE, String);//Message to tell everyone that he joined DM
SetPlayerInterior(playerid, 0); // Just like we did before we will set he's interior to 0
SetPlayerVirtualWorld(playerid, 10); // and same here Virtual World to 10
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
GivePlayerWeapon(playerid, 34, 1500); // Sniper
}
else {
InDM[playerid] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have left /sniper to join again type /sniper");
SpawnPlayer(playerid);
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
SetPlayerHealth(playerid, 50);
ResetPlayerWeapons(playerid);// and reset he's weapons
SetPlayerVirtualWorld(playerid, 0);//we will set he's virtual world to 0
SetPlayerInterior(playerid, 0);//also interior to 0
}
return 1;
}
return 0;
}
Reply
#2

Try this

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
        SetPlayerInterior(playerid, 0);
        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
        GivePlayerWeapon(playerid, 34, 1500); // Sniper
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)