IS4Code / YSF

YSF Server Functions
Other
98 stars 34 forks source link

RemoveClass and include file #17

Closed NegativeIQ closed 8 years ago

NegativeIQ commented 8 years ago

I suggest adding Remove/DestroyClass(classid) as it may be very useful. YSI y_classes have these but i guess i wouldnt hurt to have one more simple function... And add include file with all functions and callbacks to releases (R14-3 and R15 did not have include, and i even wanted to suggest SetPlayerGravity function but checked source and noticed its already there) Also suggesting adding examples for SendRPC and SendData and some more complex functions/callbacks in first post at samp forums.

Crayder commented 8 years ago

Classes are static, even y_classes' classes are static. Once created they can't be removed. y_classes simulates classes on top of the static classes. This can all be done in your script as well, I'm sure this won't be added.

oscar-broman commented 8 years ago

Resetting classes to 0 would be really simple, just modify iSpawnsAvailable in pNetGame.

If you want to delete individual ones, all you need to do is splice AvailableSpawns and decrease iSpawnsAvailable.

NegativeIQ commented 8 years ago

Yep just remove individual ones..Or maybe add another functions like DestroyAllClasses() ? These would be useful for some servers like mini games...

ghost commented 8 years ago

It's possible but only would affect newly connected players

ghost commented 8 years ago

I've did what I can to help you: https://github.com/kurta999/YSF/commit/7c86cb35932f865d4366e62898132f126be4e26c

Crayder commented 8 years ago

How about a ResetClasses? Then we could manage local ones and reset the real ones when we want to do something.

Like, I could have an array of classes in my server. I initially add them using AddPlayerClass. Then if I want to remove a few I reset them and add the ones I have left.

ghost commented 8 years ago

https://github.com/kurta999/YSF/commit/e9aa05bb9c30f2b879133bb87b055b536e7cdd1f

for(new i = GetAvailableClasses(); i != 0; i--) { RemoveLastClass(); }

all classes has been reseted.

you can add new with AddPlayerClass