Death System[rep]
#1

I am using a edited version of NG-RP. this GM is not direct NGRP but its is made from NGRP, so I got this OnPlayerDeath in it:
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
PlayerInfo[playerid][pOverdose] = 0;
    
SetPVarInt(playerid"EMSAttempt"1);
    
SetPVarInt(playerid"Injured"1);
    new 
string[128];
    
// Anti-Fake Kill by Neonman
    
if(PlayerInfo[playerid][pAdmin] < 2)
    {
        new 
time gettime();
        switch(
time LastDeath[playerid])
        {
            case 
0..3:
            {
                
DeathSpam[playerid]++;
                if(
DeathSpam[playerid] == 3// The maximum spam of deaths after the cheater will get banned.
                
{
                    new 
IP[128];
                    
GetPlayerIp(playeridIPsizeof(IP));
                    
format(stringsizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has been automatically kicked for death spamming."GetPlayerNameEx(playerid), playerid);
                    
ABroadCast(COLOR_YELLOWstring2);
                    
format(stringsizeof(string), "[Death Spam] %s has been kicked for death spam. (IP: %s)",GetPlayerNameEx(playerid), playeridIP);
                    
Log("logs/fakedeath.log"string);
                       
ShowPlayerDialog(playeridDIALOG_SHOW_INFODIALOG_STYLE_MSGBOX"{FFFFFF}Kicked from server""You have been kicked from the server for fake kill.""Ok""Cancel");
                    
SetTimerEx("SendToKick"3000"i"playerid);
                }
                return 
1;
            }
            default: 
DeathSpam[playerid] = 0;
        }
        
LastDeath[playerid] = time;
    }
    if(
IsPlayerConnected(killerid))
    {
        new 
hour,minute,secondweaponname[32];
        
gettime(hour,minute,second);
        
FixHour(hour);
        
hour shifthour;
        
GetWeaponName(reasonweaponnamesizeof(weaponname));
        
format(PlayerInfo[playerid][pKillLog9], 256"%s"PlayerInfo[playerid][pKillLog8]);
        
format(PlayerInfo[playerid][pKillLog8], 256"%s"PlayerInfo[playerid][pKillLog7]);
        
format(PlayerInfo[playerid][pKillLog7], 256"%s"PlayerInfo[playerid][pKillLog6]);
        
format(PlayerInfo[playerid][pKillLog6], 256"%s"PlayerInfo[playerid][pKillLog5]);
        
format(PlayerInfo[playerid][pKillLog5], 256"%s"PlayerInfo[playerid][pKillLog4]);
        
format(PlayerInfo[playerid][pKillLog4], 256"%s"PlayerInfo[playerid][pKillLog3]);
        
format(PlayerInfo[playerid][pKillLog3], 256"%s"PlayerInfo[playerid][pKillLog2]);
        
format(PlayerInfo[playerid][pKillLog2], 256"%s"PlayerInfo[playerid][pKillLog1]);
        
format(PlayerInfo[playerid][pKillLog1], 256"%s"PlayerInfo[playerid][pKillLog0]);
         
format(PlayerInfo[playerid][pKillLog0], 256"(%d:%d:%d) %s killed me with %s"hour,minute,second,GetPlayerNameEx(killerid), weaponname);
         
format(PlayerInfo[killerid][pKillLog9], 256"%s"PlayerInfo[killerid][pKillLog8]);
        
format(PlayerInfo[killerid][pKillLog8], 256"%s"PlayerInfo[killerid][pKillLog7]);
        
format(PlayerInfo[killerid][pKillLog7], 256"%s"PlayerInfo[killerid][pKillLog6]);
        
format(PlayerInfo[killerid][pKillLog6], 256"%s"PlayerInfo[killerid][pKillLog5]);
        
format(PlayerInfo[killerid][pKillLog5], 256"%s"PlayerInfo[killerid][pKillLog4]);
        
format(PlayerInfo[killerid][pKillLog4], 256"%s"PlayerInfo[killerid][pKillLog3]);
        
format(PlayerInfo[killerid][pKillLog3], 256"%s"PlayerInfo[killerid][pKillLog2]);
        
format(PlayerInfo[killerid][pKillLog2], 256"%s"PlayerInfo[killerid][pKillLog1]);
        
format(PlayerInfo[killerid][pKillLog1], 256"%s"PlayerInfo[killerid][pKillLog0]);
         
format(PlayerInfo[killerid][pKillLog0], 256"(%d:%d:%d) Killed %s with %s"hour,minute,second,GetPlayerNameEx(playerid), weaponname);
         if(
GetPVarInt(killerid"IsInArena") == 0PlayerInfo[killerid][pDMKills]++;
    }
    
pTazer[playerid] = 0;
    
InsideShamal[playerid] = INVALID_VEHICLE_ID;
    
DeletePVar(playerid"SpeedRadar");
    
DeletePVar(playerid"UsingSprunk");
    if(
arr_Wrecking[playerid] != INVALID_VEHICLE_ID)
    {
        
//UnwreckVehicle(arr_Wrecking[playerid], 1);
        
arr_Wrecking[playerid] = INVALID_VEHICLE_ID;
    }
    
DestroyDynamicObject(GetPVarInt(playerid"neon"));
    
DestroyDynamicObject(GetPVarInt(playerid"neon1"));
    
DeletePVar(playerid"neon0");
    
DeletePVar(playerid"neon1");
    
KillTimer(GetPVarInt(playerid"firstaid5"));
      
DeletePVar(playerid"usingfirstaid");
    
DeletePVar(playerid"usingbandage");
    if(
GetPVarInt(playerid"MovingStretcher") != -1)
    {
        
KillTimer(GetPVarInt(playerid"TickEMSMove"));
        
DeletePVar(GetPVarInt(playerid"MovingStretcher"), "OnStretcher");
        
SetPVarInt(playerid"MovingStretcher", -1);
    }
    if(
GetPVarInt(playerid"runningRadar") >= 1)
    {
        new 
vehid gLastCar[playerid];
        if(
CheckingSpeed[vehid] > 0)
        {
            
KillTimer(CheckingSpeed[vehid]);
            
CheckingSpeed[vehid] = 0;
        }
        
PlayerTextDrawDestroy(playeridRadarHud);
        
PlayerTextDrawDestroy(playeridSpeedAndModel);
        
DeletePVar(playerid"runningRadar");
        
Radars -= 1;
    }
    new 
caller Mobile[playerid];
    if(
IsPlayerConnected(Mobile[playerid]))
    {
        
SendClientMessageEx(caller,  COLOR_GRAD2"The line went dead.");
        
format(stringsizeof(string), "* %s puts away their cellphone."GetPlayerNameEx(caller));
        
ProxDetector(30.0callerstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
CellTime[caller] = 0;
        
KillTimer(VmailTmer[caller]);
        
KillTimer(VmailTmer[playerid]);
        
Mobile[caller] = INVALID_PLAYER_ID;
    }
    
Mobile[playerid] = INVALID_PLAYER_ID;
    
CellTime[playerid] = 0;
    
KillTimer(VmailTmer[playerid]);
    
KillTimer(VmailTmer[caller]);
    
RingTone[playerid] = 0;
    foreach(
Playeri)
    {
        if(
EMSAccepted[i] < 999)
        {
             if(
EMSAccepted[i] == playerid)
               {
                 
EMSAccepted[i] = 999;
                   
GameTextForPlayer(i"~w~EMS Caller~n~~r~Has Died"50001);
                
EMSCallTime[i] = 0;
                
DisablePlayerCheckpoint(i);
            }
        }
    }
    if( 
GetPVarInt(playerid"SpecOff" ) == )
    {
        
SpawnPlayer(playerid);
        return 
1;
    }
    if(
GetPVarInt(playerid"Injured") == 1)
    {
      
SendClientMessageEx(playeridCOLOR_WHITE"You appear to be stuck in limbo, medics are trying to revive you.");
        
KillEMSQueue(playerid);
        
ResetPlayerWeaponsEx(playerid);
        if(
GetPVarInt(playerid"activesling") > 0)
        {
            
DeletePVar(playerid"activesling");
        }
        
//SpawnPlayer(playerid);
        
return 1;
    }
    if(
GetPVarInt(playerid"Injured") == 3)
    {
     
SetPVarInt(playerid"MedicBill"1);
     
SetPVarInt(playerid"Injured"0);
     
SendClientMessage(playeridCOLOR_GREEN"You died! Medics were not able to come on time. you will now spawn in hospital.");
    }
    if(
GetPVarInt(playerid"IsOnFire"))
    {
        
TogglePlayerBurning(playeridfalse);
        return 
1;
    }
    new 
Float:px,Float:py,Float:pz;
    if(
GetPVarInt(playerid"EventToken") == 0)
    {
        if(
GetPVarInt(playerid"IsInArena") == -1)
        {
            
SetPVarInt(playerid"Injured"1);
            new 
Float:mXFloat:mYFloat:mZ;
            
GetPlayerPos(playeridmXmYmZ);
            
SetPVarFloat(playerid"MedicX"mX);
            
SetPVarFloat(playerid"MedicY"mY);
            
SetPVarFloat(playerid"MedicZ"mZ);
            
SetPVarInt(playerid"MedicVW"GetPlayerVirtualWorld(playerid));
            
SetPVarInt(playerid"MedicInt"GetPlayerInterior(playerid));
        }
    }
    
gPlayerSpawned[playerid] = 0;
    if(
GetPVarInt(playerid"IsInArena") >= 0)
    {
        if(
GetPVarInt(playerid"AOSlotPaintballFlag") != -1)
        {
             switch(
PlayerInfo[playerid][pPaintTeam])
               {
                 case 
1:
                   {
                    
DropFlagPaintballArena(playeridGetPVarInt(playerid"IsInArena"), 2);
                 }
                case 
2:
                  {
                    
DropFlagPaintballArena(playeridGetPVarInt(playerid"IsInArena"), 1);
                }
            }
        }
        if(
reason >= && reason <= 46)
        {
            new 
weapon[24];
            
PlayerInfo[killerid][pKills] += 1;
            
PlayerInfo[playerid][pDeaths] += 1;
            if(
PlayerInfo[killerid][pPaintTeam] == 1)
            {
                if(
PlayerInfo[killerid][pPaintTeam] == PlayerInfo[playerid][pPaintTeam])
                {
                    
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTeamRedKills] -= 1;
                    
PaintBallArena[GetPVarInt(playerid"IsInArena")][pbTeamBlueKills] += 1;
                    
SetPlayerHealth(killerid0);
                    
PlayerInfo[killerid][pKills] -= 2;
                    
PlayerInfo[killerid][pDeaths] += 1;
                    
PlayerInfo[playerid][pDeaths] -= 1;
                    
SendClientMessageEx(killeridCOLOR_WHITE"You have been warned, do not team-kill!");
                }
                else
                {
                    
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTeamRedKills] += 1;
                    
PaintBallArena[GetPVarInt(playerid"IsInArena")][pbTeamBlueDeaths] += 1;
                }
            }
            if(
PlayerInfo[killerid][pPaintTeam] == 2)
            {
                if(
PlayerInfo[killerid][pPaintTeam] == PlayerInfo[playerid][pPaintTeam])
                {
                    
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTeamBlueKills] -= 1;
                    
PaintBallArena[GetPVarInt(playerid"IsInArena")][pbTeamRedKills] += 1;
                    
SetPlayerHealth(killerid0);
                    
PlayerInfo[killerid][pKills] -= 2;
                    
PlayerInfo[killerid][pDeaths] += 1;
                    
PlayerInfo[playerid][pDeaths] -= 1;
                    
SendClientMessageEx(killeridCOLOR_WHITE"You have been warned, do not team-kill!");
                }
                
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTeamBlueKills] += 1;
                
PaintBallArena[GetPVarInt(playerid"IsInArena")][pbTeamRedDeaths] += 1;
            }
            
GetWeaponName(reason,weapon,sizeof(weapon));
            if(
reason == 0)
            {
                if(
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTimeLeft] < 12)
                {
                    
GivePlayerCash(killerid1000);
                    
format(string,sizeof(string),"[Paintball Arena] %s has earned $1000 bonus for a sudden death kill!",GetPlayerNameEx(killerid));
                    
SendPaintballArenaMessage(GetPVarInt(killerid,"IsInArena"), COLOR_YELLOWstring);
                }
                
format(string,sizeof(string),"[Paintball Arena] %s has killed %s with their bare hands!",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid));
            }
            else
            {
                if(
PaintBallArena[GetPVarInt(killerid"IsInArena")][pbTimeLeft] < 12)
                {
                    
GivePlayerCash(killerid1000);
                    
format(string,sizeof(string),"[Paintball Arena] %s has earned $1000 bonus for a sudden death kill!",GetPlayerNameEx(killerid));
                    
SendPaintballArenaMessage(GetPVarInt(killerid,"IsInArena"), COLOR_YELLOWstring);
                }
                
format(string,sizeof(string),"[Paintball Arena] %s has killed %s with a %s.",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid),weapon);
            }
        }
        else
        {
            
PlayerInfo[playerid][pDeaths] += 1;
            
format(string,sizeof(string),"[Paintball Arena] %s has died.",GetPlayerNameEx(playerid));
        }
        
SendPaintballArenaMessage(GetPVarInt(playerid,"IsInArena"), COLOR_REDstring);
    }
    
PlayerInfo[playerid][pLocal] = 255;
    
GetPlayerPos(playeridpxpypz);
    if(
GetPVarInt(playerid"Injured") == 0)
    {
        if( 
GetPVarInt(playerid"EventToken") >= || GetPVarInt(playerid"IsInArena") >= 0)
        {
            
ResetPlayerWeapons(playerid);
        }
        else
        {
            
ResetPlayerWeaponsEx(playerid);
        }
    }
    if(
PlayerInfo[killerid][pAdmin] < 2)
    {
        if(
reason == 49)
        {
            
format(stringsizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car-parked the shit out of %s (ID %d) to death."GetPlayerNameEx(killerid), killeridGetPlayerNameEx(playerid), playerid);
            
ABroadCast(COLOR_YELLOWstring2);
            print(string);
        }
        if(
reason == 50)
        {
            if(
IsAHelicopter(GetPlayerVehicleID(killerid)))
            {
                
format(stringsizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just blade-killed the shit out of %s (ID %d)."GetPlayerNameEx(killerid), killeridGetPlayerNameEx(playerid), playerid);
                
ABroadCast(COLOR_YELLOWstring2);
                print(string);
            }
            else
            {
                if(
GetPlayerWeapon(killerid) != 32 || GetPlayerWeapon(killerid) != 28 || GetPlayerWeapon(killerid) != 29)
                {
                    
format(stringsizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car-parked the shit out of %s (ID %d) to death."GetPlayerNameEx(killerid), killeridGetPlayerNameEx(playerid), playerid);
                    
ABroadCast(COLOR_YELLOWstring2);
                    print(string);
                }
                else
                {
                    
format(stringsizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just driver-shot the shit out of %s (ID %d) to death."GetPlayerNameEx(killerid), killeridGetPlayerNameEx(playerid), playerid);
                    
ABroadCast(COLOR_YELLOWstring2);
                    print(string);
                }
            }
        }
    }
    if (
gPlayerCheckpointStatus[playerid] > && gPlayerCheckpointStatus[playerid] < 11)
    {
        
DisablePlayerCheckpoint(playerid);
        
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
    }
    if(
HaveGPS[playerid])
    {
        
KillTimer(GPSTimer[playerid]);
        
HaveGPS[playerid] = false;
        
GPSTimer[playerid] = 0;
    }
    
ClearCrime(playerid);
    if(
PlayerInfo[playerid][pHeadValue] >= 1)
    {
        if(
IsPlayerConnected(killerid))
        {
            if(
GoChase[killerid] == playerid)
            {
                new 
killer[MAX_PLAYER_NAME],
                    
name[MAX_PLAYER_NAME], ID;
                new 
takemoney PlayerInfo[playerid][pHeadValue] / 2;
                 
name GetPlayerNameEx(playerid);
                
killer GetPlayerNameEx(killerid);
                
GivePlayerCash(killeridtakemoney);
                
sscanf(PlayerInfo[playerid][pContractBy],"u",ID);
                if(!
IsPlayerConnected(ID))
                {
                    
OnPlayerOfflineLogin(PlayerInfo[playerid][pContractBy]);
                    
PlayerInfo[MAX_PLAYERS][pAccount] -= takemoney;
                    
OnPlayerOfflineSave(PlayerInfo[playerid][pContractBy]);
                }
                else
                {
                    
format(stringsizeof(string), "Hitman %s has fulfilled the contract on %s and you have paid them $%d.",killer,name,takemoney);
                    
SendClientMessageEx(IDCOLOR_YELLOWstring);
                    
GivePlayerCash(ID, -takemoney);
                }
                
format(string,128,"Hitman %s has fulfilled the contract on %s and collected $%d.",killer,name,PlayerInfo[playerid][pHeadValue] / 2);
                
SendFamilyMessage(8COLOR_YELLOWstring);
                
format(string,128,"You have been critically injured by a hitman.",takemoney);
                   
ResetPlayerWeaponsEx(playerid);
                
// SpawnPlayer(playerid);
                
SendClientMessageEx(playeridCOLOR_YELLOWstring);
                
// KillEMSQueue(playerid);
                
PlayerInfo[playerid][pHeadValue] = 0;
                
PlayerInfo[killerid][pCHits] += 1;
                
GotHit[playerid] = 0;
                
GetChased[playerid] = 999;
                
GoChase[killerid] = 999;
            }
        }
    }
    if(
IsPlayerConnected(killerid))
     {
        if(
GoChase[playerid] == killerid)
        {
            new 
killer[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
            new 
takemoney PlayerInfo[playerid][pHeadValue] / 2;
            
GivePlayerCash(killeridtakemoney);
            
name GetPlayerNameEx(playerid);
            
killer GetPlayerNameEx(killerid);
            
format(string,128,"Hitman %s has failed the contract on %s and lost $%d.",name,killer,PlayerInfo[killerid][pHeadValue] / 2);
            
SendFamilyMessage(8COLOR_YELLOWstring);
            
GivePlayerCash(playerid, -takemoney);
               
format(string,128,"You have just killed a hitman and gained $%d, removing the contact on your head.",PlayerInfo[killerid][pHeadValue] / 2);
            
SendClientMessageEx(killeridCOLOR_YELLOWstring);
            
PlayerInfo[killerid][pHeadValue] = 0;
            
PlayerInfo[playerid][pFHits] += 1;
            
GotHit[playerid] = 0;
            
GetChased[killerid] = 999;
            
GoChase[playerid] = 999;
        }
    }
    
killerid INVALID_PLAYER_ID;
    
SetPlayerColor(playerid,TEAM_HIT_COLOR);
    return 
1;

But I don't want to use this so can anyone help me to make this like When a player dies he spawns at same place and Die Animation is applied and with time(about every 30 seconds) his health reduce some amount until he is not dead again and if he dies again he spawns at hospital? currently when a layer dies he directly spawns in hoapital.

This is some thing that might help you to set spawn in hospital:
in SetPlayerSpawn(playerid) :
PHP код:
if(GetPVarInt(playerid"MedicBill") == && PlayerInfo[playerid][pJailed] == 0)
        {
            
PlayerInfo[playerid][pDuty] = 0;
            
PlayerInfo[playerid][pVW] = 0;
            
PlayerInfo[playerid][pInt] = 0;
            
SetPlayerVirtualWorld(playerid0);
            if(
IsACop(playerid) || IsALVMPDCop(playerid))
            {
                
SendClientMessageExplayeridTEAM_CYAN_COLOR"Hospital: Hospital staff has cleared and discharged you for patrol. Your duty weapons have been returned." );
                
SetPlayerWeapons(playerid);
            }
            else
            {
                
SendClientMessageExplayeridTEAM_CYAN_COLOR"Hospital: Before you are discharged, hospital staff will confiscate your weapons." );
                
ResetPlayerWeapons(playerid);
            }
            if( 
GetPVarIntplayerid"EventToken" ) == )
            {
                
//SendClientMessageEx( playerid, COLOR_WHITE, "As you've just come from an event, your weapons have been refunded." );
            
}
            
SetPVarInt(playerid"MedicBill"1);
            
SetPlayerInterior(playerid0);
            new 
string[70+MAX_PLAYER_NAME];
            if(
PlayerInfo[playerid][pInsurance] == 1)
            {
                if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                {
                    
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                    
format(stringsizeof(string), " County General Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                    
SendRadioMessage(1DEPTRADIOstring);
                    
SendRadioMessage(2DEPTRADIOstring);
                    
SendRadioMessage(3DEPTRADIOstring);
                    
SendRadioMessage(5DEPTRADIOstring);
                    
SendRadioMessage(7DEPTRADIOstring);
                    
SendRadioMessage(11DEPTRADIOstring);
                    
SendRadioMessage(13DEPTRADIOstring);
                    
SendRadioMessage(18DEPTRADIOstring);
                }
                
SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
                
SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
                
SetPlayerPos(playerid1999.5308,-1449.3281,10.5594);
                
SetPVarInt(playerid"Hospital"2);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 2)
            {
                if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                {
                    
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                    
format(stringsizeof(string), " All Saints Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                    
SendRadioMessage(1DEPTRADIOstring);
                    
SendRadioMessage(2DEPTRADIOstring);
                    
SendRadioMessage(3DEPTRADIOstring);
                    
SendRadioMessage(5DEPTRADIOstring);
                    
SendRadioMessage(7DEPTRADIOstring);
                    
SendRadioMessage(11DEPTRADIOstring);
                    
SendRadioMessage(13DEPTRADIOstring);
                    
SendRadioMessage(18DEPTRADIOstring);
                }
                
SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
                
SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
                
SetPlayerPos(playerid1188.4574,-1309.2242,10.5625); // Warp the player
                
SetPVarInt(playerid"Hospital"1);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 3)
            {
                if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                {
                    
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                    
format(stringsizeof(string), " Red County Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                    
SendRadioMessage(1DEPTRADIOstring);
                    
SendRadioMessage(2DEPTRADIOstring);
                    
SendRadioMessage(3DEPTRADIOstring);
                    
SendRadioMessage(5DEPTRADIOstring);
                    
SendRadioMessage(7DEPTRADIOstring);
                    
SendRadioMessage(11DEPTRADIOstring);
                    
SendRadioMessage(13DEPTRADIOstring);
                    
SendRadioMessage(18DEPTRADIOstring);
                }
                
SetPlayerCameraPos(playerid,1248.4147,338.8385,19.4063+6.0);
                
SetPlayerCameraLookAt(playerid,1241.4449,326.3389,19.7555);
                
SetPlayerPos(playerid1248.4147,338.8385,19.4063);
                
SetPVarInt(playerid"Hospital"3);
            }
               else if(
PlayerInfo[playerid][pInsurance] == 4)
            {
                if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                {
                    
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                    
format(stringsizeof(string), " Fort Carson Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                    
SendRadioMessage(1DEPTRADIOstring);
                    
SendRadioMessage(2DEPTRADIOstring);
                    
SendRadioMessage(3DEPTRADIOstring);
                    
SendRadioMessage(5DEPTRADIOstring);
                    
SendRadioMessage(7DEPTRADIOstring);
                    
SendRadioMessage(11DEPTRADIOstring);
                    
SendRadioMessage(13DEPTRADIOstring);
                    
SendRadioMessage(18DEPTRADIOstring);
                }
                
SetPlayerCameraPos(playerid,-314.0242,1060.7919,19.5938+6.0);
                
SetPlayerCameraLookAt(playerid,-320.0992,1049.0341,20.3403);
                
SetPlayerPos(playerid, -314.0242,1060.7919,19.5938);
                
SetPVarInt(playerid"Hospital"4);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 5)
            {
                if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                {
                    
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                    
format(stringsizeof(string), " Las Vegas Medical Center has reported %s as a wanted person."GetPlayerNameEx(playerid));
                    
SendRadioMessage(1DEPTRADIOstring);
                    
SendRadioMessage(2DEPTRADIOstring);
                    
SendRadioMessage(3DEPTRADIOstring);
                    
SendRadioMessage(5DEPTRADIOstring);
                    
SendRadioMessage(7DEPTRADIOstring);
                    
SendRadioMessage(11DEPTRADIOstring);
                    
SendRadioMessage(13DEPTRADIOstring);
                    
SendRadioMessage(18DEPTRADIOstring);
                    
SendRadioMessage(19DEPTRADIOstring);
                }
                
SetPlayerCameraPos(playerid,-2571.2766,558.7813,68.1754);
                
SetPlayerCameraLookAt(playerid,-2619.2883,596.2850,49.0966);
                
SetPlayerPos(playerid, -2653.6685,626.6485,4.8930);
                
SetPVarInt(playerid"Hospital"5);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 6)
            {
                
SetPlayerCameraPos(playerid,2787.1020502392.1628411243.898681);
                
SetPlayerCameraLookAt(playerid,2801.2819822404.5756831240.531127);
                
SetPlayerPos(playerid2788.5615232387.3210441227.350219);
                
SetPVarInt(playerid"Hospital"7);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 7)
            {
                
SetPlayerCameraPos(playerid,2787.1020502392.1628411243.898681);
                
SetPlayerCameraLookAt(playerid,2801.2819822404.5756831240.531127);
                
SetPlayerPos(playerid2788.5615232387.3210441227.350219);
                
SetPVarInt(playerid"Hospital"8);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 8)
            {
                if(
PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
                {
                    
PlayerInfo[playerid][pInsurance] = 0;
                    
SetPlayerSpawn(playerid);
                }
                new 
Float:XFloat:YFloat:Z;
                
GetObjectPos(Carrier[0], XYZ);
                
SetPlayerCameraPos(playerid,(X-100),(Y-100),30);
                
SetPlayerCameraLookAt(playerid,XYZ);
                
SetPlayerPos(playerid, (X-0.377671),(Y-10.917018),0);
                
SetPVarInt(playerid"Hospital"9);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 9)
            {
                
SetPlayerCameraPos(playerid, -1529.8471672539.39404262.038913);
                
SetPlayerCameraLookAt(playerid, -1514.8833002527.16113255.743553);
                
SetPlayerPos(playerid, -1514.8092042526.30517551.865501);
                
SetPVarInt(playerid"Hospital"10);
            }
            else if(
PlayerInfo[playerid][pInsurance] == 10)
            {
                if(
PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
                {
                    
PlayerInfo[playerid][pInsurance] = 0;
                    
SetPlayerSpawn(playerid);
                }
                
SetPlayerPos(playerid272.3733,2043.6031,-100.0);
                
SetPlayerCameraPos(playerid150.1812,2000.4531,51.3394);
                
SetPlayerCameraLookAt(playerid150.1812,2000.4531,51.3394);
                
TogglePlayerControllable(playerid0);
                
SetPVarInt(playerid"Hospital"11);
            }
               if(
PlayerInfo[playerid][pInsurance] == 0)
            {
                new 
randhos Random(1,4);
                 switch (
randhos)
                   {
                    case 
1:
                      {
                        if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                        {
                            
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                            
format(stringsizeof(string), " All Saints Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                            
SendRadioMessage(1DEPTRADIOstring);
                            
SendRadioMessage(2DEPTRADIOstring);
                            
SendRadioMessage(3DEPTRADIOstring);
                            
SendRadioMessage(5DEPTRADIOstring);
                            
SendRadioMessage(7DEPTRADIOstring);
                            
SendRadioMessage(11DEPTRADIOstring);
                            
SendRadioMessage(13DEPTRADIOstring);
                            
SendRadioMessage(18DEPTRADIOstring);
                        }
                        
SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
                        
SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
                        
SetPlayerPos(playerid1188.4574,-1309.2242,10.5625); // Warp the player
                        
SetPVarInt(playerid"Hospital"6);
                      }
                    case 
2:
                    {
                        if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                        {
                            
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                            
format(stringsizeof(string), " County General Hospital has reported %s as a wanted person."GetPlayerNameEx(playerid));
                            
SendRadioMessage(1DEPTRADIOstring);
                            
SendRadioMessage(2DEPTRADIOstring);
                            
SendRadioMessage(3DEPTRADIOstring);
                            
SendRadioMessage(5DEPTRADIOstring);
                            
SendRadioMessage(7DEPTRADIOstring);
                            
SendRadioMessage(11DEPTRADIOstring);
                            
SendRadioMessage(13DEPTRADIOstring);
                            
SendRadioMessage(18DEPTRADIOstring);
                        }
                        
SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
                        
SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
                        
SetPlayerPos(playerid1999.5308,-1449.3281,10.5594);
                        
SetPVarInt(playerid"Hospital"2);
                       }
                    case 
3:
                    {
                        if(
PlayerInfo[playerid][pWantedLevel] >= 1)
                        {
                            
SendClientMessageEx(playeridCOLOR_YELLOW" The police has been warned that you are wanted and they are on their way.");
                            
format(stringsizeof(string), " Las Vegas Medical Center has reported %s as a wanted person."GetPlayerNameEx(playerid));
                            
SendRadioMessage(1DEPTRADIOstring);
                            
SendRadioMessage(2DEPTRADIOstring);
                            
SendRadioMessage(3DEPTRADIOstring);
                            
SendRadioMessage(5DEPTRADIOstring);
                            
SendRadioMessage(7DEPTRADIOstring);
                            
SendRadioMessage(11DEPTRADIOstring);
                            
SendRadioMessage(13DEPTRADIOstring);
                            
SendRadioMessage(18DEPTRADIOstring);
                            
SendRadioMessage(19DEPTRADIOstring);
                        }
                        
SetPlayerCameraPos(playerid,-2571.2766,558.7813,68.1754);
                        
SetPlayerCameraLookAt(playerid,-2619.2883,596.2850,49.0966);
                        
SetPlayerPos(playerid, -2653.6685,626.6485,4.8930);
                        
SetPVarInt(playerid"Hospital"12);
                       }
                   }
            }
            
TogglePlayerControllable(playerid0);
            
SetPlayerHealth(playerid0.5);
            
SetPVarInt(playerid"HospitalTimer"30);
            
SetTimerEx("OtherTimerEx"1000false"ii"playeridTYPE_HOSPITALTIMER);
            return 
1;
        } 
Thanks in advance.
Reply
#2

Try adding Injured varint in OnPlayerSpawn
Reply
#3

Well I made it to what I wanted now, there is just one problem, is that the player is not landing(after death) at same place he died.... how can I do it?

and yes, I am using GetPlayerPos and SetPlayerPos in OnPlayerDeath still not helping.
Reply
#4

at onplayerspawn call your saved position, SetPlayerPos
Reply
#5

Well in OnPlayerSpawn I did it but still it makes a player to fall from sky not at place he died!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)