01.05.2011, 05:35
(
Последний раз редактировалось Swiftz; 10.05.2011 в 08:05.
)
I edited Admantis second life script
I created 3 values for a variable IsDead, It checks if player is in which state (2= Alive, 1= Waiting treatment (injured) 0 = hospital)
So my first function when player is dead is
And under onplayerspawn
And the function SetPlayerinhospital puts player in some co-ordinates and camera e.t.c , Ok but when the player dies, He just spawns at the place he died and he can move, SendClientMessage (such as You are wounded badly) doesnt work, Any ideas? Please help it is major problme
I created 3 values for a variable IsDead, It checks if player is in which state (2= Alive, 1= Waiting treatment (injured) 0 = hospital)
So my first function when player is dead is
Код:
public OnPlayerDeath(playerid, killerid, reason) { new Float:pX22, Float:pY22, Float:pZ22; GetPlayerPos(playerid, pX22, pY22, pZ22); PlayerInfo[playerid][pDeathPosX] = pX22; PlayerInfo[playerid][pDeathPosY] = pY22; PlayerInfo[playerid][pDeathPosZ] = pZ22; if(PlayerInfo[playerid][pIsDead] == 2) { PlayerInfo[playerid][pIsDead] = 1; } if(PlayerInfo[playerid][pIsDead] == 0) { Some script here.. return 1; } return 1; }
Код:
if(newstate == PLAYER_STATE_WASTED) //PLAYER DIES { if(PlayerInfo[playerid][pJailed] == 1) { if(PlayerInfo[playerid][pIsDead] == 0) { PlayerInfo[playerid][pHospital] = 1; } if(PlayerInfo[playerid][pIsDead] == 2) { PlayerInfo[playerid][pIsDead] = 1; } } }
Код:
if(PlayerInfo[playerid][pIsDead] == 1) { SetPlayerPos(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosZ]); SetPlayerCameraPos(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosX]+5); SetPlayerCameraLookAt(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosZ]); TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0); SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid); SendClientMessage(playerid,CYAN,"------------------ Health Advise -----------------"); SendClientMessage(playerid,WHITE,"You are wounded badly."); SendClientMessage(playerid,WHITE,"Do /service EMS For calling medics."); SendClientMessage(playerid,WHITE,"You can type /acceptdeath, if no medics are available."); SendClientMessage(playerid,CYAN,"--------------------------------------------------------"); }