Jump to content

Limiting ped per player


Recommended Posts

Hi everybody,

I managed to edit my ped spawning script to set a per-player (+server) zombie limit.

Global limit is set to 200 (ie), each player can spawn 15 peds which will follow them. If the player kill one of them, the a new ped can spawn as the count is under the limit.

So, to do that i've tried the following :

local variable follow

When the ped-spawn is called on my script, it add +1 on a "setElementData" attached to player name. And so, if he kill one, this "setElementData" got -1 as value (actual -1)

In the paper, this way to do looks really perfect 8) But in fact, not really.

The spawn stop at 15 (its fine), but if another player connect, no ped spawn for him (so, the per-player 15 is set to the entire server).

Does anyone have any idea about this function or maybe some help ?

Thank you very much and have a nice week-end.

Link to comment
playertable and there you make a ped table for each player :)

Or like this

pedCountTable = {}

then you can set a new item for each player

pedCountTable[thePlayer] = countOfPeds

Thank you for your help, its was really helpful.

But, It looks that making this limit is harder than I thought.

Thank you anyway ;)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...