Scripting Help - 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)
+--- Thread: Scripting Help (
/showthread.php?tid=626279)
Scripting Help -
Disorder - 13.01.2017
I've been doing some research and was brain storming on my idea. What I'm looking for is when you die you stay in the same place so a medic can come get you by doing (/ems), but I can't figure it out. When I get killed it sends me DIRECTLY to hospital, how can I make it to where I stay there until somebody kills me while i'm down(cant move) or until I bleed out or just give up (/accept death)
Re: Scripting Help -
Lordzy - 13.01.2017
You'll have to work on creating custom death system then. Because once the player dies, they get spawned automatically. I suggest you to work on server sided health system which will then help you to work on features like these. There's an include named "weapon-config.inc" by Slice that can help you with what you're looking for. I never used it since I've already got what I want but I guess that's what's probably you're gonna need unless you're going to create your own system.
Re: Scripting Help -
darkdrago - 13.01.2017
You can't stop the death, but a lot of servers does that system in another way...
Do something like that
Код:
enum death_system
{
Float:DX,
Float:DY,
Float:DZ,
Float:DA,
bool:Status
};
new DeathInfo[MAX_PLAYERS][death_system];
In your hospital script place
Код:
if(!DeathInfo[playerid][Status])
OnPlayerDeath
Код:
new Float:x,Float:y,Float:z,Float:a;
DeathInfo[playerid][DX] = x;
DeathInfo[playerid][DY] = y;
DeathInfo[playerid][DZ] = z;
DeathInfo[playerid][DA] = a;
DeathInfo[playerid][Status] = true;
OnPlayerSpawn
Код:
if(DeathInfo[playerid][Status])
{
SetPlayerPos(playerid,DeathInfo[playerid][DX],DeathInfo[playerid][DY],DeathInfo[playerid][DZ]);
SetPlayerFacingAngle(playerid,DeathInfo[playerid][DA]);
SetPlayerHealth(playerid,1.0);
//Animation crack or something you would like to use
}
Now it's simple, if he accepts to death do
Код:
if(DeathInfo[playerid][Status])
{
DeathInfo[playerid][Status]=false;
SetPlayerHealth(playerid,0);
}
Quote:
Originally Posted by Lordzy
I suggest you to work on server sided health system which will then help you to work on features like these.
|
It would be good for making an Anticheat, but for those things only that would be really annoying x
Re: Scripting Help -
Lordzy - 13.01.2017
Quote:
Originally Posted by darkdrago
You can't stop the death, but a lot of servers does that system in another way...
Do something like that
Код:
enum death_system
{
Float:DX,
Float:DY,
Float:DZ,
Float:DA,
bool:Status
};
new DeathInfo[MAX_PLAYERS][death_system];
In your hospital script place
Код:
if(!DeathInfo[playerid][Status])
OnPlayerDeath
Код:
new Float:x,Float:y,Float:z,Float:a;
DeathInfo[playerid][DX] = x;
DeathInfo[playerid][DY] = y;
DeathInfo[playerid][DZ] = z;
DeathInfo[playerid][DA] = a;
DeathInfo[playerid][Status] = true;
OnPlayerSpawn
Код:
if(DeathInfo[playerid][Status])
{
SetPlayerPos(playerid,DeathInfo[playerid][DX],DeathInfo[playerid][DY],DeathInfo[playerid][DZ]);
SetPlayerFacingAngle(playerid,DeathInfo[playerid][DA]);
SetPlayerHealth(playerid,1.0);
//Animation crack or something you would like to use
}
Now it's simple, if he accepts to death do
Код:
if(DeathInfo[playerid][Status])
{
DeathInfo[playerid][Status]=false;
SetPlayerHealth(playerid,0);
}
It would be good for making an Anticheat, but for those things only that would be really annoying x
|
To make it more realistic, my idea is a lot better. Or to improve what you said, I'd suggest using SetSpawnInfo under OnPlayerDeath.
Re: Scripting Help -
darkdrago - 13.01.2017
Quote:
Originally Posted by Lordzy
To make it more realistic, my idea is a lot better. Or to improve what you said, I'd suggest using SetSpawnInfo under OnPlayerDeath.
|
Well, if he wanna improve it he could set it then spawn the player immediately, but my system was just an example to make him understand how it could work
Re: Scripting Help -
GoldenLion - 13.01.2017
https://sampforum.blast.hk/showthread.php?tid=558839 this might give you an idea of how you could make the custom death.
Re: Scripting Help -
darkdrago - 13.01.2017
Quote:
Originally Posted by GoldenLion
|
It doesn't help him to what he wanna do, that's just an explaining of OnPlayerTakeDamage and OnPlayerGiveDamage