Hospital problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Hospital problem (
/showthread.php?tid=225365)
Hospital problem -
Mean - 13.02.2011
Hello, I am making a RP script from scratch, but I have a little problem.
When I die, I don't go to hospital. I just spawn normally.
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PInfo[playerid][AdminDuty] == 1)
{
label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 10000);
GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
}
SetTimerEx( "HospitalTimer2", 1000, 0, "d", playerid );
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PInfo[playerid][Deaths]++;
PInfo[killerid][Kills]++;
PInfo[ playerid ][ ForHospital ] = 1;
return 1;
}
pawn Код:
public HospitalTimer( playerid )
{
TogglePlayerControllable( playerid, 1 );
GameTextForPlayer( playerid, "Realased from hospital", 3000, 6 );
SpawnPlayer( playerid );
return 1;
}
public HospitalTimer2( playerid )
{
if( PInfo[ playerid ][ ForHospital ] == 1 )
{
TogglePlayerControllable( playerid, 0 );
SetPlayerPos( playerid, 2309.0232,-1142.1338,1055.1511 );
SetPlayerInterior( playerid, 12 );
SetPlayerFacingAngle( playerid, 359.8549 );
SetPlayerCameraLookAt( playerid, 2309.0232,-1142.1338,1055.1511 );
GameTextForPlayer( playerid, "You are in hospital now, please wait for doctors to cure you", 3000, 6 );
SetTimerEx( "HospitalTimer", 60*1000, 0, "d", playerid );
PInfo[ playerid ][ ForHospital ] = 0;
}
return 1;
}
AnyHelp?
Re: Hospital problem -
SkizzoTrick - 13.02.2011
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PInfo[playerid][AdminDuty] == 1)
{
label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 10000);
GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
}
if(PlayerInfo[playerid][ForHospital] == 1)
{
SetTimerEx( "HospitalTimer2", 1000, 0, "d", playerid );
}
return 1;
}
public HospitalTimer2( playerid )
{
TogglePlayerControllable( playerid, 0 );
SetPlayerPos( playerid, 2309.0232,-1142.1338,1055.1511 );
SetPlayerInterior( playerid, 12 );
SetPlayerFacingAngle( playerid, 359.8549 );
SetPlayerCameraLookAt( playerid, 2309.0232,-1142.1338,1055.1511 );
GameTextForPlayer( playerid, "You are in hospital now, please wait for doctors to cure you", 3000, 6 );
SetTimerEx( "HospitalTimer", 60*1000, 0, "d", playerid );
PInfo[ playerid ][ ForHospital ] = 0;
return 1;
}
I guess that's the problem
I changed the spital check.I moved it at OnPlayerSpawn
Re: Hospital problem -
Mean - 13.02.2011
Will try later. Will say here if it did work. Can't now.