Syntax Error or Invalid Function Expression -
LI0LIKAS - 22.01.2018
I want to make the "DEAD1" timer appear on screen, but I don't know why I get this error. Maybe you can you help me?
Код:
gamemodes\SAMG.pwn(670) : error 076: syntax error in the expression, or invalid function call
Код:
public RespawnHospital(playerid)
{
SetSpawnInfo(playerid,GetPlayerTeam(playerid),GetPlayerSkin(playerid),322.197998,302.497985,999.148437,275.7301,0,0,0,0,0,0);
GetGender(playerid);
SetPlayerInterior(playerid, 5);
SetTimerEx("DEAD1", 60000, false, "i", playerid);
new string[5];
format(string, sizeof(string), "%d", DEAD1);
GameTextForPlayer(playerid, string, 1200, 4);
SpawnPlayer(playerid);
return 1;
}
public DEAD1(playerid)
{
SetPlayerHealth(playerid,100);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1242.1780,328.2336,19.7555);
SendClientMessage(playerid,WHITE,"* Pasveikai.");
return 1;
}
Re: Syntax Error or Invalid Function Expression -
Rolux - 22.01.2018
DEAD1 returns 1.
Why do you want to show this to the player?
Try it like this:
(Sorry, don't have time to test it.)
Код:
new hpString[3];
new hpTimeLeft[MAX_PLAYERS];
forward HospitalTimeLeft(playerid);
public HospitalTimeLeft(playerid)
{
hpTimeLeft[playerid] = hpTimeLeft[playerid] - 1;
format(hpString,sizeof(hpString),"%d",hpTimeLeft[playerid]);
GameTextForPlayer(playerid, hpString,1000, 4);
return 1;
}
public RespawnHospital(playerid)
{
SetSpawnInfo(playerid,GetPlayerTeam(playerid),GetPlayerSkin(playerid),322.197998,302.497985,999.148437,275.7301,0,0,0,0,0,0);
GetGender(playerid);
SetPlayerInterior(playerid, 5);
SetTimerEx("DEAD1", 60000, false, "i", playerid);
hpTimeLeft[playerid] = 60; //60 sec
SetTimerEx("HospitalTimeLeft", 1000, false, "i", playerid);
SpawnPlayer(playerid);
return 1;
}
public DEAD1(playerid)
{
SetPlayerHealth(playerid,100);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1242.1780,328.2336,19.7555);
SendClientMessage(playerid,WHITE,"* Pasveikai.");
return 1;
}
Re: Syntax Error or Invalid Function Expression -
LI0LIKAS - 22.01.2018
When the player dies, he spawns in the hospital for 1 minute. I want a timer to be shown on screen to see, how much time is left. After 1 minute, he spawns outside the hospital.
You can read my thread:
https://sampforum.blast.hk/showthread.php?pid=3982728#pid3982728
Anyway, your timer doesn't work. After death when I spawn to the hospital, the timer freezes at "59" for 1 second and disappears.
Re: Syntax Error or Invalid Function Expression -
Rolux - 22.01.2018
Yeah ,you are right.
I edited it a bit:
Код:
new hpString[3];
new hpTimeLeft[MAX_PLAYERS];
new hpTimer[MAX_PLAYERS];
forward HospitalTimeLeft(playerid);
public HospitalTimeLeft(playerid)
{
hpTimeLeft[playerid] = hpTimeLeft[playerid] - 1;
format(hpString,sizeof(hpString),"%d",hpTimeLeft[playerid]);
GameTextForPlayer(playerid, hpString,1000, 4);
return 1;
}
public RespawnHospital(playerid)
{
SetSpawnInfo(playerid,GetPlayerTeam(playerid),GetPlayerSkin(playerid),322.197998,302.497985,999.148437,275.7301,0,0,0,0,0,0);
GetGender(playerid);
SetPlayerInterior(playerid, 5);
SetTimerEx("DEAD1", 60000, false, "i", playerid);
hpTimeLeft[playerid] = 60; //60 sec
hpTimer[playerid] = SetTimerEx("HospitalTimeLeft", 1000, true, "i", playerid);
SpawnPlayer(playerid);
return 1;
}
public DEAD1(playerid)
{
SetPlayerHealth(playerid,100);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1242.1780,328.2336,19.7555);
SendClientMessage(playerid,WHITE,"* Pasveikai.");
KillTimer(hpTimer[playerid]);
return 1;
}
Re: Syntax Error or Invalid Function Expression -
LI0LIKAS - 22.01.2018
Thank you very much! I gave you +REP