08.05.2014, 14:05
i want my player should spawn after death at the position where he typed the command and joined the Dm.
i tried this script but it didn't work, player is spawning some where in the air.
where is the mistake
?
the player is spawning some where in sky.
thanks in advance
i tried this script but it didn't work, player is spawning some where in the air.
pawn Код:
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;
}

the player is spawning some where in sky.
thanks in advance