new InDM[MAX_PLAYERS];
new Dead[MAX_PLAYERS];
new DmID[MAX_PLAYERS];
new Float:dmx, Float:dmy, Float:dmz;
CMD:mgdm(playerid, params[])
{
InDM[playerid] = 1;
DmID[playerid] = 1;
InLobby[playerid] = 0;
GetPlayerPos(playerid, dmx, dmy, dmz);
SendClientMessage(playerid, -1, "{FFFF00}Welcome to Minigun DM !");
SetPlayerInterior(playerid, 14);
new rand = random(sizeof(RandomSpawnMGDM));
SetPlayerPos(playerid, RandomSpawnMGDM[rand][0], RandomSpawnMGDM[rand][1], RandomSpawnMGDM[rand][2]);
SetPlayerVirtualWorld(playerid, 32);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 38, 100000);
new str[56+MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "{9933FF}***%s (ID: %d) has joined Minigun DM. (/mgdm)!", name, playerid);
SendClientMessageToAll(-1, str);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
if(InDM[playerid] == 1)
{
if(killerid != INVALID_PLAYER_ID)
{
GivePlayerMoney(killerid, 5000);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
SendClientMessage(killerid, -1, "You have been awarded $5000 & +1 Score for killing your opponent in DM.");
InDM[playerid] = 1;
InLobby[playerid] = 1;
Dead[playerid] = 1;
return 1;
}
}
public OnPlayerSpawn(playerid)
{
if(Dead[playerid] == 1 && InDM[playerid] == 1)
{
SetPlayerPos(playerid, dmx, dmy, dmz);
Dead[playerid] = 0;
DmID[playerid] = 0;
InDM[playerid] = 0;
}
return 1;
}
Set the interior to 14 when the player spawn again.
Use the floats with player arrays, or itll go bugged. new Float:dmx, Float:dmy, Float:dmz; to new Float:dmx[MAX_PLAYERS], Float:dmy[MAX_PLAYERS], Float:dmz[MAX_PLAYERS]; |
new oldDMposX[MAX_PLAYERS],
oldDMposY[MAX_PLAYERS],
oldDMposZ[MAX_PLAYERS];
new Float:oldDMposX[MAX_PLAYERS],
Float:oldDMposY[MAX_PLAYERS],
Float:oldDMposZ[MAX_PLAYERS];
new InDM[MAX_PLAYERS];
new Dead[MAX_PLAYERS];
new DmID[MAX_PLAYERS];
new Float:dmx[MAX_PLAYERS], Float:dmy[MAX_PLAYERS], Float:dmz[MAX_PLAYERS];
CMD:mgdm(playerid, params[])
{
InDM[playerid] = 1;
DmID[playerid] = 1;
InLobby[playerid] = 0;
GetPlayerPos(playerid, dmx[playerid], dmy[playerid], dmz[playerid]);
SetTimerEx("DMTimer",100,true,"u",playerid);
return 1;
}
forward DMTimer(playerid);
public DMTimer(playerid)
{
SendClientMessage(playerid, -1, "{FFFF00}Welcome to Minigun DM !");
SetPlayerInterior(playerid, 14);
new rand = random(sizeof(RandomSpawnMGDM));
SetPlayerPos(playerid, RandomSpawnMGDM[rand][0], RandomSpawnMGDM[rand][1], RandomSpawnMGDM[rand][2]);
SetPlayerVirtualWorld(playerid, 32);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 38, 100000);
new str[56+MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "{9933FF}***%s (ID: %d) has joined Minigun DM. (/mgdm)!", name, playerid);
SendClientMessageToAll(-1, str);
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
if(InDM[playerid] == 1)
{
if(killerid != INVALID_PLAYER_ID)
{
GivePlayerMoney(killerid, 5000);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
SendClientMessage(killerid, -1, "You have been awarded $5000 & +1 Score for killing your opponent in DM.");
InDM[playerid] = 1;
InLobby[playerid] = 1;
Dead[playerid] = 1;
return 1;
}
}
}
public OnPlayerSpawn(playerid)
{
if(Dead[playerid] == 1 && InDM[playerid] == 1)
{
SetPlayerPos(playerid, dmx[playerid], dmy[playerid], dmz[playerid]);
Dead[playerid] = 0;
DmID[playerid] = 0;
InDM[playerid] = 0;
}
return 1;
}