05.04.2015, 15:12
So when the player dies, it sets a cj skin in blueberry acres, and once they press 'spawn' that when it teleports them back to their death pos and applys animation..
I need it so when the player dies it just re spawns him at the location with his original skin and not having to press the /spawn option.
ON PLAYER DEATH:
ON PLAYER SPAWN:
I need it so when the player dies it just re spawns him at the location with his original skin and not having to press the /spawn option.
ON PLAYER DEATH:
Код:
public OnPlayerDeath(playerid, killerid, reason) { new pname[MAX_PLAYER_NAME], kname[MAX_PLAYER_NAME], string[128], Float: X, Float: Y, Float: Z; GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(killerid, kname, sizeof(kname)); GetPlayerPos(playerid, X, Y, Z); pDeathPosX[playerid] = X; pDeathPosY[playerid] = Y; pDeathPosZ[playerid] = Z; pInfo[playerid][Mask] = 0; pDeathMode[playerid] = 1; if(killerid != INVALID_PLAYER_ID) { format(string, sizeof(string), "%d %s has just killed %d %s using a %s (%d)", killerid, kname, playerid, pname, GunName[reason], reason); SendAdminMessage(COLOR_YELLOW, string); } return 1; }
Код:
public OnPlayerSpawn(playerid) { SetPlayerColor(playerid, 1); TogglePlayerSpectating(playerid, 0); if(pDeathMode[playerid] == 1) { SetPlayerPos(playerid, pDeathPosX[playerid], pDeathPosY[playerid], pDeathPosZ[playerid]); SetPlayerHealth(playerid, 100); TogglePlayerControllable(playerid, false); SetPlayerSkin(playerid, pInfo[playerid][Skin]); SendClientMessage(playerid, -1, "You've lost consciousness!"); SetTimerEx("PlayerDeathMode", 1500, false, "i", playerid); } else if(pDeathMode[playerid] == 2) { SetPlayerColor(playerid, -1); pDeathMode[playerid] = 0; SetPlayerSkin(playerid, pInfo[playerid][Skin]); SetPlayerPos(playerid, 43.6618, -188.0078, 2.2442); SetPlayerHealth(playerid, 70); } else if(pInfo[playerid][LastPos] == 0) SetPlayerPos(playerid, 250.7732, -193.0894, 2.0562); ResetPlayerMoney(playerid); // doing this avoids HandMoney to duplicate (aka get 2x the amount u had earlier) GivePlayerMoney(playerid, pInfo[playerid][HandMoney]); SetPlayerSkin(playerid, pInfo[playerid][Skin]); GivePlayerWeapon(playerid, pInfo[playerid][Weapon1], pInfo[playerid][Wep1Ammo]); GivePlayerWeapon(playerid, pInfo[playerid][Weapon2], pInfo[playerid][Wep2Ammo]); GivePlayerWeapon(playerid, pInfo[playerid][Weapon3], pInfo[playerid][Wep3Ammo]); GivePlayerWeapon(playerid, pInfo[playerid][Weapon4], pInfo[playerid][Wep4Ammo]); GivePlayerWeapon(playerid, pInfo[playerid][Weapon5], pInfo[playerid][Wep5Ammo]); // ---- System rewrites (bug fixed) ---- // if(pInfo[playerid][Registered] == 0) RegisterFix(playerid); SetPlayerHealth(playerid, pInfo[playerid][Health]); SetPlayerArmour(playerid, pInfo[playerid][Armour]); //TextDrawShowForPlayer(playerid, wMark0); //TextDrawShowForPlayer(playerid, wMark1); return 1; }