svGroups - Player Organization -
SuperViper - 29.04.2012
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
Function | Action | Returns |
svGroup_Debug(bool: debug) | Toggles script debugging | 1 |
svGroup_SetPlayer(playerid, groupid) | Puts the player in the specified group | 1 |
|
svGroup_GetPlayer(playerid) | Gets the player's group ID | Player's group ID |
svGroup_CountMembers(groupid) | Counts the amount of members in a group | The amount of members in the group |
svGroup_SetHealth(groupid, Float: Health) | Sets the health of all members in a group | 0 if no members are in the group, otherwise 1 |
svGroup_SetArmor(groupid, Float: Armor) | Sets the armor of all members in a group | 0 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 position | 1 |
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 information | 1 |
svGroup_ToggleControllable(groupid, bool: controllable) | Toggles if the group's member can control their character or not | 0 if no members are in the group, otherwise 1 |
svGroup_GiveMoney(groupid, money) | Gives the specified group a certain amount of money | 0 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 ID | 1 |
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
Callback | Call Time | Note |
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 of | Automatically prevents the player from entering the car |
Script Settings
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.
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.
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
Version | Change |
Version 1.3 | Allowed vehicles to be added to groups. |
Version 1.2 | Resolved an issue with ALS hooking. |
Version 1.1 | Added svGroup_GiveMoney function. |
Version 1.1 | Resolved an issue with hooking callbacks (completely forgot about that) |
Version 1.0 | Created the script |
Using
To begin using this include, drag the file to your
pawno > includes folder and put
at the top of your script.
Credits
SuperViper - Creating the script
****** - foreach and y_hooks
Re: svGroups - Player Organization -
Ballu Miaa - 29.04.2012
It is just like gTeams variable defined in the script isnt it? Which doesnt save like factions?
Looks good to me. Nice work Viper.
Re: svGroups - Player Organization -
SuperViper - 29.04.2012
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.
Re: svGroups - Player Organization -
SuperViper - 29.04.2012
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.
Re: svGroups - Player Organization -
SuperViper - 25.05.2012
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.
Re: svGroups - Player Organization -
dPlaYer_ - 25.05.2012
Nice work viper
Re: svGroups - Player Organization -
qinaixiuor - 25.05.2012
To use this, you must have the foreach include.
Re: svGroups - Player Organization -
SuperViper - 25.05.2012
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.