Help with time OnPlayerDeath
#1

Hey i just scripted in my server when people die they respawn in front of the hosptial, and spawn with 50.0 hp. I am trying to make it so when they die the camera mode changes to just looking in front of All Saints, and they are stuck in this mode for 20 seconds before spawning in front of All Saints.Please, can anyone help me!

This is my Script:
public OnPlayerDeath(playerid)
{

Hspawn[playerid] = 1;

return 0;
}

public OnPlayerSpawn(playerid)
{
if (Hspawn[playerid] == 1)
{
if(GetPlayerMoney(playerid) > 100)
{
SetPlayerHealth(playerid, 50.5);
SetPlayerPos(playerid,1176.6060,-1323.7875,14.0296);
SendClientMessage(playerid,0xDD000096,"You spawned at the Los Santos hospital.");
SendClientMessage(playerid,0xFFFFFF96,"|-----------------------------------|");
SendClientMessage(playerid,0xDD000096,"Your medical bill cost: 100$");
GivePlayerMoney(playerid, -100);
return 1;
}
}
return 1;
}
Reply
#2

PHP код:
public OnPlayerSpawn(playerid)
{
if (
Hspawn[playerid] == 1)
{
if(
GetPlayerMoney(playerid) > 100)
{
Hspawn[playerid] = 0;
SetPlayerHealth(playerid50.5);
SetPlayerCameraPos(playeridxyz);
SetPlayerCameraLookAt(playeridxyz);
TogglePlayerControllable(playeridtrue);
SetTimerEx("SpawnPlayerToHospital"200000"%d"playerid);
SendClientMessage(playerid,0xDD000096,"You spawned at the Los Santos hospital.");
SendClientMessage(playerid,0xFFFFFF96,"|-----------------------------------|");
SendClientMessage(playerid,0xDD000096,"Your medical bill cost: 100$");
GivePlayerMoney(playerid, -100);
return 
1;
}
}
return 
1;

forward SpawnPlayerToHospital(playerid);
public 
SpawnPlayerToHospital(playerid)
{
TogglePlayerControllable(playeridfalse);
SetPlayerPos(playerid,1176.6060,-1323.7875,14.0296);
SetCameraBehindPlayer(playerid);

remember to change the xyz of the camera.
Reply
#3

This is what i did and it does not work=\

public OnPlayerSpawn(playerid)
{
if (Hspawn[playerid] == 1)
{
if(GetPlayerMoney(playerid) > 100)
{
Hspawn[playerid] = 0
SetPlayerHealth(playerid, 50.5);
SetPlayerCameraPos(playerid, 1190.1182,-1323.4784,13.566;
SetPlayerCameraLookAt(playerid, 1178.7699,-1323.2892,14.1365);
TogglePlayerControllable(playerid, true);
SendClientMessage(playerid,0xDD000096,"You spawned at the Los Santos hospital.");
SendClientMessage(playerid,0xFFFFFF96,"|-----------------------------------|");
SendClientMessage(playerid,0xDD000096,"Your medical bill cost: 100$");
GivePlayerMoney(playerid, -100);
return 1;
}
}
return 1;
}

foward SpawnPlayerToHospital(playerid);
public SpawnPlayerToHospital(playerid);
{
TogglePlayerControllable(playerid, false);
SetPlayerPos(playerid,1176.6060,-1323.7875,14.0296);
SetCameraBehindPlayer(playerid);
}
Reply
#4

you forget the SetTimerEx, take a look at my code again.
Reply
#5

I added the SetTimerEx, and now i get these errors:

C:\samp\sampserver\samp03csvr_win32\filterscripts\ mytestserver1.pwn(6) : error 010: invalid function or declaration
C:\samp\sampserver\samp03csvr_win32\filterscripts\ mytestserver1.pwn(169) : error 001: expected token: ";", but found "-identifier-"
C:\samp\sampserver\samp03csvr_win32\filterscripts\ mytestserver1.pwn(185) : error 055: start of function body without function header
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#6

public SpawnPlayerToHospital(playerid); shouldn't have an ;
public SpawnPlayerToHospital(playerid) will fix the errors.
Reply
#7

i deleted the ; and still get errors:
C:\samp\sampserver\samp03csvr_win32\gamemodes\myte stserver1.pwn(169) : error 001: expected token: ";", but found "-identifier-"
C:\samp\sampserver\samp03csvr_win32\gamemodes\myte stserver1.pwn(184) : error 010: invalid function or declaration
C:\samp\sampserver\samp03csvr_win32\gamemodes\myte stserver1.pwn(185) : warning 235: public function lacks forward declaration (symbol "SpawnPlayerToHospital")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

2 Errors.

This is my script:
public OnPlayerDeath(playerid)
{
Hspawn[playerid] = 1;

return 0;
}

public OnPlayerSpawn(playerid)
{
if (Hspawn[playerid] == 1)
{
if(GetPlayerMoney(playerid) > 100)
{
Hspawn[playerid] = 0
SetPlayerHealth(playerid, 50.5);
SetPlayerCameraPos(playerid, 1190.1182,-1323.4784,13.566;
SetPlayerCameraLookAt(playerid, 1178.7699,-1323.2892,14.1365);
TogglePlayerControllable(playerid, true);
SetTimerEx("SpawnPlayerToHospital", 20000, 0, "%d", playerid);
SendClientMessage(playerid,0xDD000096,"You spawned at the Los Santos hospital.");
SendClientMessage(playerid,0xFFFFFF96,"|-----------------------------------|");
SendClientMessage(playerid,0xDD000096,"Your medical bill cost: 100$");
GivePlayerMoney(playerid, -100);
return 1;
}
}
return 1;
}

foward SpawnPlayerToHospital(playerid);
public SpawnPlayerToHospital(playerid)
{
TogglePlayerControllable(playerid, false);
SetPlayerPos(playerid,1176.6060,-1323.7875,14.0296);
SetCameraBehindPlayer(playerid);
}
Reply
#8

pawn Код:
public OnPlayerDeath(playerid)
{
Hspawn[playerid] = 1;

return 0;
}

public OnPlayerSpawn(playerid)
{
if (Hspawn[playerid] == 1)
{
if(GetPlayerMoney(playerid) > 100)
{
Hspawn[playerid] = 0;
SetPlayerHealth(playerid, 50.5);
SetPlayerCameraPos(playerid, 1190.1182,-1323.4784,13.566);
SetPlayerCameraLookAt(playerid, 1178.7699,-1323.2892,14.1365);
TogglePlayerControllable(playerid, true);
SetTimerEx("SpawnPlayerToHospital", 20000, 0, "%d", playerid);
SendClientMessage(playerid,0xDD000096,"You spawned at the Los Santos hospital.");
SendClientMessage(playerid,0xFFFFFF96,"|-----------------------------------|");
SendClientMessage(playerid,0xDD000096,"Your medical bill cost: 100$");
GivePlayerMoney(playerid, -100);
return 1;
}
}
return 1;
}

forward SpawnPlayerToHospital(playerid);
public SpawnPlayerToHospital(playerid)
{
TogglePlayerControllable(playerid, false);
SetPlayerPos(playerid,1176.6060,-1323.7875,14.0296);
SetCameraBehindPlayer(playerid);
}
Reply
#9

This works, but when the player spawns, he is still frozen, how can i fix this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)