If you die armour stay. -
Ernestas_ - 27.04.2012
Hi. I have problem with "If player dies, armor stay". How can I do it? I tried this:
Код:
new Float:deatharmor; // At the top
public OnPlayerDeath(playerid, killerid, reason)
deatharmor = GetPlayerArmour(playerid);
and
public OnPlayerSpawn( playerid )
SetPlayerArmour(playerid, deatharmor);
Re: If you die armour stay. -
FalconX - 27.04.2012
Quote:
Originally Posted by Ernestas_
Hi. I have problem with "If player dies, armor stay". How can I do it? I tried this:
Код:
new Float:deatharmor; // At the top
public OnPlayerDeath(playerid, killerid, reason)
deatharmor = GetPlayerArmour(playerid);
and
public OnPlayerSpawn( playerid )
SetPlayerArmour(playerid, deatharmor);
|
You want a person to stay with an armour? like when he dies and respawn he must have the armour? If that so use the following:-
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerArmour(playerid, 100); // use this in OnPlayerSpawn so when a player spawn he spawn with an armour.
return 1;
}
-FalconX
Re: If you die armour stay. -
MP2 - 27.04.2012
Well, if you have armour and take damage from someone, it depletes, so how can it 'stay'? You can't die while having armour (well, certain circumstances i.e. fire I think and vehicle collisions).
Re: If you die armour stay. -
Ernestas_ - 27.04.2012
Armor don't disappear then u fall and etc. I need that if u had 50 armour, when u fall or smth after death u will get 50 armour.
Re: If you die armour stay. -
MP2 - 27.04.2012
Why would you want to keep armour after death <.<
Re: If you die armour stay. -
FalconX - 27.04.2012
Quote:
Originally Posted by Ernestas_
Armor don't disappear then u fall and etc. I need that if u had 50 armour, when u fall or smth after death u will get 50 armour.
|
Okay, I will write a code for you, as I'm on my ipad don't blame me for mistakes.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:armour;
GetPlayerArmour(playerid, armour);
return 1;
}
and the other one is OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerArmour(playerid, armour);
SendClientMessage(playerid, -1, "SERVER: Your armour has been restored.");
return 1;
}
For more info have a look on
https://sampwiki.blast.hk/wiki/GetPlayerArmour
Give it a try
-FalconX
Re: If you die armour stay. -
Ernestas_ - 27.04.2012
Quote:
Originally Posted by MP2
Why would you want to keep armour after death <.<
|
In my server only high lvl people can get armour, and can get armour not always.
FalconX, i will try it soon.
Re: If you die armour stay. -
MP2 - 27.04.2012
That won't work because you're using local variables.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:pArmour;
GetPlayerArmour(playerid, pArmour);
SetPVarFloat(playerid, "pArmour", pArmour);
return 1;
}
public OnPlayerSpawn(playerid)
{
new Float:pArmour;
GetPVarFloat(playerid, "pArmour", pArmour);
SetPlayerArmour(playerid, pArmour);
return 1;
}
Re: If you die armour stay. -
FalconX - 27.04.2012
Quote:
Originally Posted by MP2
That won't work because you're using local variables.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { new Float:pArmour; GetPlayerArmour(playerid, pArmour); SetPVarFloat(playerid, "pArmour", pArmour); return 1; }
public OnPlayerSpawn(playerid) { new Float:pArmour; GetPVarFloat(playerid, "pArmour", pArmour); SetPlayerArmour(playerid, pArmour); return 1; }
|
Oh ok Thanks for correcting me
Re: If you die armour stay. -
Ernestas_ - 27.04.2012
Код:
D:\GangWorld\GM\gamemodes\perfect.pwn(187) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
187:
Код:
GetPVarFloat(playerid, "pArmour", pArmour);