Help with spectacting
#1

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
Reply
#2

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
Reply
#3

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];.
Reply
#4

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
Reply
#5

Did it like this but it still same

pawn Код:
SetPlayerHealth(playerid, LastHealth[playerid]);
    SetPlayerArmour(playerid, LastArmor[playerid]);
// in specoff command
Reply
#6

bUmp
Reply
#7

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;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)