[Include] svGroups - Player Organization
#1

Introduction

This script allows you to organize all of your players into separate groups and allows you to apply your script actions to each group of players seperately.


Functions

FunctionActionReturns
svGroup_Debug(bool: debug)Toggles script debugging1
svGroup_SetPlayer(playerid, groupid)Puts the player in the specified group1
svGroup_GetPlayer(playerid)Gets the player's group IDPlayer's group ID
svGroup_CountMembers(groupid)Counts the amount of members in a groupThe amount of members in the group
svGroup_SetHealth(groupid, Float: Health)Sets the health of all members in a group0 if no members are in the group, otherwise 1
svGroup_SetArmor(groupid, Float: Armor)Sets the armor of all members in a group0 if no members are in the group, otherwise 1
svGroup_SetSpawn(groupid, Float: sX, Float: sY, Float: sZ, sInterior = 0, sVirtualWorld = 0, Float: sA = 0.0)Sets the group's spawn position1
svGroup_SetSpawnInfo(groupid, skin, Float: sHealth = 0.0, Float: sArmor = 0.0, weapon1 = 0, weapon1ammo = 0, weapon2 = 0, weapon3ammo = 0, weapon4 = 0, weapon4ammo = 0, weapon5 = 0, weapon5ammo = 0, color = -1)Sets the group's spawn information1
svGroup_ToggleControllable(groupid, bool: controllable)Toggles if the group's member can control their character or not0 if no members are in the group, otherwise 1
svGroup_GiveMoney(groupid, money)Gives the specified group a certain amount of money0 if no members are in the group, otherwise 1
svGroup_SetVehicleGroup(vehicleid, groupid)Removes the vehicle from all other groups and sets it to only that group ID1
svGroup_AddVehicleToGroup(vehicleid, groupid)Adds a vehicle to a group (allows multiple groups)1
svGroup_RemoveVehicleFromGroup(vehicleid, groupid)Removes a vehicle from a group (allows multiple groups)1 if the vehicle was in the group, otherwise -1
svGroup_IsVehicleInGroup(vehicleid, groupid)Checks if the vehicle is in a certain group (allows multiple groups)1 if the vehicle is in the group, otherwise 0

Callbacks

CallbackCall TimeNote
svGroups_OnPlayerInBlockedCar(playerid, vehicleid, ispassenger, playergroupid)Called when a player attempts to enter a car which belongs to a group that he isn't a part ofAutomatically prevents the player from entering the car

Script Settings

pawn Код:
#define USE_FOREACH
Comment this line if you want to use regular 'for' loops instead of the foreach include by ******. To use this, you must have the foreach include.

pawn Код:
#define USE_YHOOKS
Comment this line if you want to use regular 'ALS' hooks instead of the y_hooks include by ******. To use this, you must have the y_hooks include or YSI.

pawn Код:
#define GROUP_AMOUNT 15
This defines how many maximum groups there in the server. The lower the number, the less memory this include uses.


Bugs and Suggestions

Please reply to this thread with your bug report or suggestion for the include. All of these posts will be reviewed carefully and dealt with.


Versions

The download links and the include itself will be updated occasionally.

Version 1.3 - Pastebin | Mediafire | Assembla Direct Download
Version 1.2 - Pastebin | Mediafire | Assembla Direct Download
Version 1.1 - Pastebin | Mediafire
Version 1.0 - Pastebin | Mediafire



Don't want to wait for updates?

I'm currently uploading all of my changes to an Assembla account. Assembla will be updated before updates are released. If you wish to get the files directly from Assembla, use SVN Checkout with this URL: https://subversion.assembla.com/svn/sv-libraries/

My latest updates to Assembla are below:




Changelog

VersionChange
Version 1.3Allowed vehicles to be added to groups.
Version 1.2Resolved an issue with ALS hooking.
Version 1.1Added svGroup_GiveMoney function.
Version 1.1Resolved an issue with hooking callbacks (completely forgot about that)
Version 1.0Created the script

Using

To begin using this include, drag the file to your pawno > includes folder and put

pawn Код:
#include <svGroups>
at the top of your script.


Credits

SuperViper - Creating the script
****** - foreach and y_hooks
Reply
#2

It is just like gTeams variable defined in the script isnt it? Which doesnt save like factions?

Looks good to me. Nice work Viper.
Reply
#3

Pretty much except for the fact that this has added functions that instead of affecting a certain player, affect the whole group.

EDIT: Found an issue with hooking, version 1.1 added.
Reply
#4

y_groups doesn't offer functions that this does and I only made y_hooks optional because some people don't have YSI. By default, it uses y_hooks.

EDIT: Found an issue with ALS hooking. A new version has been released.
Reply
#5

Version 1.3 has been released and it allows users to add vehicles to (multiple) groups, which will disallow players who aren't in the vehicle's group from entering the vehicle.

Note:

I haven't updated this lately because I haven't been getting any suggestions. Keep the suggestions coming and I'll implement them rapidly.
Reply
#6

Nice work viper
Reply
#7

To use this, you must have the foreach include.
Reply
#8

Quote:
Originally Posted by qinaixiuor
Посмотреть сообщение
To use this, you must have the foreach include.
It's optional. You can use regular loops in the settings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)