Help with spectacting - 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: Help with spectacting (
/showthread.php?tid=511516)
Help with spectacting -
Ananisiki - 06.05.2014
I have problem with my spectacting commend
i have onplayerspawn SetPlayerHealth 100, armour and so on, when i spec someone with 0 armour and 50 % health, then on /specoff i spawn with 100 armour and 100 health, how i can stop this
I get weapon too
Re: Help with spectacting -
Jefff - 06.05.2014
in OnPlayerSpawn use spectaceid or spectaced 0/1
pawn Код:
if(SpectaceID[playerid] != INVALID_PLAYER_ID)
{
SpectaceID[playerid] = INVALID_PLAYER_ID;
return 1;
}
100hp
armour code
rest
Re: Help with spectacting -
SickAttack - 06.05.2014
I'll suggest storing the players health and armour in 2 variable when they start spectating then when they stop spectating set the players health and armour to the variable. Note that the variable must be a float. Example: new Float:PlayerHealthEx[MAX_PLAYERS];.
Re: Help with spectacting -
XK - 06.05.2014
Well when player does /spec to spec someone get his armor and health and save them,when he /specoff give him the health and the armor you saved,easy
Re: Help with spectacting -
Ananisiki - 06.05.2014
Did it like this but it still same
pawn Код:
SetPlayerHealth(playerid, LastHealth[playerid]);
SetPlayerArmour(playerid, LastArmor[playerid]);
// in specoff command
Re: Help with spectacting -
Ananisiki - 06.05.2014
bUmp
Re: Help with spectacting -
SickAttack - 06.05.2014
On top of your code:
pawn Код:
new Float:LastHealth[MAX_PLAYERS], Float:LastArmour[MAX_PLAYERS];
/spec:
pawn Код:
GetPlayerHealth(playerid, LastHealth[playerid]);
GetPlayerArmour(playerid, LastArmour[playerid]);
SetPlayerHealth(playerid, 9999);
SetPlayerArmour(playerid, 9999);
OnPlayerSpawn in an exception:
pawn Код:
if(PlayerSpectating[playerid] == 1)
{
SetPlayerHealth(playerid, LastHealth[playerid]);
SetPlayerArmour(playerid, LastArmour[playerid]);
PlayerSpectating[playerid] = 0;
}