02.03.2013, 01:12
(
Last edited by Scrillex; 11/03/2013 at 03:18 AM.
)
Hello forum members!
This is my first tutorial and I will try to explain how to use y_groups to set player team with them.
So first of all you need to download YSI you can find it here : https://sampforum.blast.hk/showthread.php?pid=1696956#pid1696956
After downloading extract it and you will see the folder YSI-master cut out the contents of a folder and paste it in your server localation.
Now when it's done open new pawn and add include.
After that we will start to add new variables (groups).
Ofcorse this will be only example for that you can set group names as you wish.
So basicly we have 4 groups (only variables so now wee will define them as groups)
Under public OnGameModeInit()
we need to set groups definitions.
Now we will set group by AddPlayerClass to see which is in which team. (Basically TDM Or DM server sets)
Here will be some explanation why I'm using Class_AddWithGroupSet( and not another function.
To let player choose more groups you can only setting group current skins. If you will use Class_AddForGroup(group,
Player who connected will see only current skins which will be added to the group with this function.
So for example:
If you are using multiple groups like in this case (example):
So, when a player connects you will see only a group of crips because he will automatically set the player group crips.
Using Class_AddForGroup (group, function group which sees the player chooses, and gives him his selected group.
I hope that you have noticed that the next step is to add to the player's individual class with skin to current groups.
So as at start we setted this variables:
Now we will use them.
For example:
You need to change group to your variable like : gHoodRats which was set on variable.
So as next step is add weapons and armor.
So here will be some list of weapons you can add:
So and now how to set amount of bullets and weapons for example:
Remember that it sets armor, weapon and bullets when player spawns.
So to use them we need to remove too.
So next step is removing them OnPlayerRequestSpawn because it will set then it to another group not to the correct group thats why we need to remove them.
Group_SetPlayer sets in which team is player.
gHoodRats = player is in hoodrats team
playerid = by connected players id
false = is not true.
So this is all about how to set groups with y_group.
Now next step how to set group cars it's very simple.
For example:
So here will be faster way.
So basically that's all I will update it.
So Now I will show you how to add a command for group..
So as you can see we set cmd can be used only for team GSF So basiclly thats all.... Soon I think I will update it with saving in which groupt player is. When player connects all data will be seenable + maybe with registartion and admin system...
Big thanks to ****** and everyone who helped me to learn how to use it.
If you need some examples ask I will show you and send you by pm or post them on thread!
With Respect Scrillex!
This is my first tutorial and I will try to explain how to use y_groups to set player team with them.
So first of all you need to download YSI you can find it here : https://sampforum.blast.hk/showthread.php?pid=1696956#pid1696956
After downloading extract it and you will see the folder YSI-master cut out the contents of a folder and paste it in your server localation.
Now when it's done open new pawn and add include.
pawn Code:
#include <YSI\y_groups>
#include <YSI\y_classes>
Ofcorse this will be only example for that you can set group names as you wish.
pawn Code:
new
Group:gHoodRats, //So this is team one my choosen name is HoodRats as you can see.
Group:gGSF, //group 2
Group:gSBF, //group3
Group:gTDF //group 4
;
Under public OnGameModeInit()
we need to set groups definitions.
pawn Code:
gHoodRats = Group_Create("HoodRats"); //Basically we set group one.
gGSF = Group_Create("GSF"); //Group 2
gSBF = Group_Create("SBF"); //Group 3
gTDF = Group_Create("TDF"); //Group 4
pawn Code:
Class_AddWithGroupSet(gHoodRats,15, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gHoodRats,170, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gHoodRats,183, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gHoodRats,263, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
//GroveStreet
Class_AddWithGroupSet(gGSF,270, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gGSF,105, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gGSF,106, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gGSF,107, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
//SBF
Class_AddWithGroupSet(gSBF,0, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gSBF,105, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gSBF,106, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gSBF,107, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
//TDF
Class_AddWithGroupSet(gTDF,269, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gTDF,105, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gTDF,106, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddWithGroupSet(gTDF,107, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
To let player choose more groups you can only setting group current skins. If you will use Class_AddForGroup(group,
Player who connected will see only current skins which will be added to the group with this function.
So for example:
If you are using multiple groups like in this case (example):
pawn Code:
Class_AddForGroup(gCrips, 29, 0, 0, 0, 0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddForGroup(gAdmin, 29, 0, 0, 0, 0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddForGroup(gLeader, 29, 0, 0, 0, 0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Class_AddForGroup(gVIP, 29, 0, 0, 0, 0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
Using Class_AddForGroup (group, function group which sees the player chooses, and gives him his selected group.
I hope that you have noticed that the next step is to add to the player's individual class with skin to current groups.
So as at start we setted this variables:
pawn Code:
new
Group:gHoodRats, //So this is team one my choosen name is HoodRats as you can see.
Group:gGSF, //group 2
Group:gSBF, //group3
Group:gTDF //group 4
;
For example:
pawn Code:
Class_AddWithGroupSet(group, skin, x, y, z, a, (weapon, amm)…);
So as next step is add weapons and armor.
So here will be some list of weapons you can add:
pawn Code:
WEAPON_BRASSKNUCKLE
WEAPON_GOLFCLUB
WEAPON_NITESTICK
WEAPON_KNIFE
WEAPON_BAT
WEAPON_SHOVEL
WEAPON_POOLSTICK
WEAPON_KATANA
WEAPON_CHAINSAW
WEAPON_DILDO
WEAPON_DILDO2
WEAPON_VIBRATOR
WEAPON_VIBRATOR2
WEAPON_FLOWER
WEAPON_CANE
WEAPON_GRENADE
WEAPON_TEARGAS
WEAPON_MOLTOV
WEAPON_COLT45
WEAPON_SILENCED
WEAPON_DEAGLE
WEAPON_SHOTGUN
WEAPON_SAWEDOFF
WEAPON_SHOTGSPA
WEAPON_UZI
WEAPON_MP5
WEAPON_AK47
WEAPON_M4
WEAPON_TEC9
WEAPON_RIFLE
WEAPON_SNIPER
WEAPON_ROCKETLAUNCHER
WEAPON_HEATSEEKER
WEAPON_FLAMETHROWER
WEAPON_MINIGUN
WEAPON_SATCHEL
WEAPON_BOMB
WEAPON_SPRAYCAN
WEAPON_FIREEXTINGUISHER
WEAPON_CAMERA
WEAPON_PARACHUTE
pawn Code:
WEAPON_MP5 //Weapon name
500 //Bullets
WEAPON_ARMOUR
50 //How much armor player will have
And this is how it needs to look:
Class_AddWithGroupSet(gTDF,107, 1958.3783, 1343.1572, 15.3746, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50, WEAPON_DEAGLE, 200);
So to use them we need to remove too.
So next step is removing them OnPlayerRequestSpawn because it will set then it to another group not to the correct group thats why we need to remove them.
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
Group_SetPlayer(gHoodRats, playerid, false); // Remove from the group HoodRats
Group_SetPlayer(gGSF, playerid, false); //Remove from the group GSF
Group_SetPlayer(gSBF, playerid, false); //Remove from the group SBF
Group_SetPlayer(gTDF, playerid, false); //Remove from the group TDF
return 1;
}
gHoodRats = player is in hoodrats team
playerid = by connected players id
false = is not true.
So this is all about how to set groups with y_group.
Now next step how to set group cars it's very simple.
For example:
pawn Code:
enum TeamCars //Making enum for team cars..
{
GroveStreet,
GroveStreet1,
}
new Cars[TeamCars]; //variable
public OnGameModeInit()
{
Cars[GroveStreet] = AddStaticVehicleEx(492,2499.5000000,-1655.4000200,13.3000000,60.0000000,18,20,15); //Greenwood //sets Grovestreet car..
Cars[GroveStreet1] = AddStaticVehicleEx(412,2503.8000500,-1684.6999500,13.5000000,24.0000000,12,20,15);
return 1;
}
So here you will see example how it besaclly looksAnd which is long way... (But ain't bad to)
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER) //checks if player is in driver state
{
new CarCheck = GetPlayerVehicleID(playerid); //variable
if(CarCheck == Cars[GroveStreet]) //check if player is in grovestreet car
{
if (Group_GetPlayer(gGSF, playerid)) //Check if player is in grove street
{
SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You aren't in team Grove Street Crips");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
if(CarCheck == Cars[GroveStreet1]) //check if player is in grovestreet car
{
if (Group_GetPlayer(gGSF, playerid)) //Check if player is in grove street
{
SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You aren't in team Grove Street Crips");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
}
return 1;
}
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER) //checks if player is in driver state
{
new CarCheck = GetPlayerVehicleID(playerid); //variable
if(CarCheck == Cars[GroveStreet] || Cars[GroveStreet1] || Cars[GroveStreet2]) //check if player is in grovestreet car
{
if (Group_GetPlayer(gGSF, playerid)) //Check if player is in grove street
{
SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You aren't in team Grove Street Crips");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
//If you have gangs or multiple group cars....
if(CarCheck == Cars[Bloodz] || Cars[Bloodz1] || Cars[Bloodz2]) //check if player is in grovestreet car
{
if (Group_GetPlayer(gBloodz, playerid)) //Check if player is in grove street
{
SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You aren't in team Bloodz");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
}
return 1;
}
So Now I will show you how to add a command for group..
pawn Code:
public OnGameModeInit()
{
Group_SetGlobalCommand(YCMD:kill, false);//Sets command for all players to false!
Group_SetCommand(gGSF, YCMD:kill, true);//Sets command for gGSF members to true!
return 1;
}
pawn Code:
YCMD:kill(playerid, params[], help)//params[] = What this does is create one variable at a suitable size [256 is NOT a suitable size!], but here we are not using it..
{
SetPlayerHealth(playerid, 0.0); // Sets players Health to 0 Also if you want you can add SendCliendMessage
return 1;
}
Big thanks to ****** and everyone who helped me to learn how to use it.
If you need some examples ask I will show you and send you by pm or post them on thread!
With Respect Scrillex!