SA-MP Forums Archive
How to make spawning with armour ? - 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: How to make spawning with armour ? (/showthread.php?tid=456743)



How to make spawning with armour ? - bustern - 07.08.2013

Hello.How to do this ?When player join to the server and he spawn, he get 100 armour ?


Re: How to make spawning with armour ? - -Prodigy- - 07.08.2013

You want to give them armour only the first time they spawn after connect? Or every time they spawn?

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerArmour(playerid, 100.0);
    return 1;
}
That will give them armour every time they spawn

pawn Код:
new bool: hadArmour[MAX_PLAYERS] = {false, ...};

public OnPlayerSpawn(playerid)
{
    if(hadArmour{playerid} == false)
    {
        SetPlayerArmour(playerid, 100.0);
        hadArmour{playerid} = true;
    }
    return 1;
That will only give them armour the first time they spawn.


Re: How to make spawning with armour ? - Konstantinos - 07.08.2013

I believe {playerid} should be if it was declared:
pawn Код:
new bool: hadArmour[MAX_PLAYERS char];



Re: How to make spawning with armour ? - bustern - 07.08.2013

I want to give armour when they spawn.Where i must put the code ?(that is for police class for my server)


Re: How to make spawning with armour ? - Konstantinos - 07.08.2013

This will give amrour everytime a cop spawns.
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == POLICE_CLASS) SetPlayerArmour(playerid, 100.0);
    // Change the variable and the police's number to yours
    return 1;
}



Re: How to make spawning with armour ? - XStormiest - 07.08.2013

Just simply do:
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerArmour(playerid, 100.0); //sets the armour of the player to 100
    return 1;
}