16.09.2011, 18:26
A quick script I wrote, it compiled, untested though:
pawn Код:
// Hospital filterscript by Mean.
// When you die, you get teleported to hospital and stay in there for the specified amount of time.
// Use wisely.
#include < a_samp >
static died[ MAX_PLAYERS ];
#define PUB:%1(%2) forward %1(%2); \
public %1(%2)
#define HOSPITAL_TIME 60 // In seconds. Default = 60.
#define MSG_ENTER_HOSPITAL "You almost died due to a heavy medical problem. The doctors saved your life."
#define MSG_EXIT_HOSPITAL "You have recovered from your injuries. You have been released from the hospital."
public OnPlayerConnect( playerid )
return died[ playerid ] = 0, true;
public OnPlayerDeath( playerid, killerid, reason )
return died[ playerid ] = 1, true;
public OnPlayerSpawn( playerid ) {
if( died[ playerid ] == 1 ) {
// Set interior and position to the hospital.
SendClientMessage( playerid, -1, MSG_ENTER_HOSPITAL );
SetTimerEx( "hospitalrelease", HOSPITAL_TIME * 1000, 0, "i", playerid );
died[ playerid ] = 0;
}
return true;
}
PUB:hospitalrelease( playerid ) {
SendClientMessage( playerid, -1, MSG_EXIT_HOSPITAL );
return SpawnPlayer( playerid ), true;
}