[Include] Insanity Vehicles Groups
#1

• Insanity Vehicles Groups •

- Description

It allows you to set any vehicle to any group, and each vehicle only will can
be driven by the player that's of your group(or not, configurable).

- Author

Allan Jader (CyNiC)

- Note

You can change how much you want the filterscript, leaving the credit to the
author.


Functions
pawn Code:
native AddGroupedVehicle(model, group, Float:X, Float:Y, Float:Z, Float:Rotation, color1, color2, bool: lock = false, respawn_delay = 0);
native PutVehicleInGroup(vehicleid, group, bool: lock = false);
native RemoveVehicleFromGroup(vehicleid, group);
native IsVehicleInGroup(vehicleid, group);
native PutPlayerInGroup(playerid, group, bool: unlockforplayer = true);
native RemovePlayerFromGroup(playerid, group, bool: lockforplayer = true);
native IsPlayerInGroup(playerid, group);
native VehicleGroupStateChange(playerid, newstate);
native VehicleGroupStreamIn(vehicleid, forplayerid);
native vGroup_OnGameModeInit();

Configuration

Is necessary add these 3 functions on your Gamemode/Filterscript:
pawn Code:
VehicleGroupStateChange(playerid, newstate);       //Add on init of callback OnPlayerStateChange
VehicleGroupStreamIn(vehicleid, forplayerid);      //Add on init of callback OnVehicleStreamIn
vGroup_OnGameModeInit();                           //Add on init of callback OnGameModeInit
#define MAX_GROUPS 50                              //change for your value

Download Version 1.0
http://www.4shared.com/file/8397z9yp/vgroup.html
Download Version 2.0.2
Vehicles can have more than one group, functions names changed, and small optimizations.
Some problems solved.
http://www.4shared.com/file/dffPB0L9...Groups_20.html
Reply
#2

Looks great, nice job.
Reply
#3

yes what ive been looking for good for my gang vehicles thanks
Reply
#4

Good Idea
It looks nice
Reply
#5

great job buddy. I was waiting for it.
Reply
#6

Thanks, report any problem.
Reply
#7

It's an cool idea, but can players from other groups enter the cars of other groups?
Reply
#8

Quote:
Originally Posted by Kwarde
View Post
It's an cool idea, but can players from other groups enter the cars of other groups?
Yes, can be diferent if you want.

Using AddGroupedVehicle:

Standart: AddGroupedVehicle(model, group, Float:X, Float:Y, Float:Z, Float:Rotation, color1, color2, don't write nothing here respawn_delay = 0);

Locked for other groups: AddGroupedVehicle(model, group, Float:X, Float:Y, Float:Z, Float:Rotation, color1, color2, true, respawn_delay = 0);

Using SetVehicleGroup:

Standart: SetVehicleGroup(vehicleid, groupdon't write nothing here);

Locked for other groups: SetVehicleGroup(vehicleid, group, true);
Reply
#9

Ah I thought that was just global lock. Thanks. I'll see if I'm gonna use it
But if I'm gonna use it, I'll edit, ok? (Still your credits). I have an wire for auto hacking system
Reply
#10

No Problems.
Reply
#11

Roger. I'll see what I'll do when I'm done with some business.
And thanks

- Kevin
Reply
#12

Updated for 2.0:

Vehicles can have more than one group, functions names changed, and small optimizations.

http://www.4shared.com/file/A64wSTnu/vgroup_2.html
Reply
#13

hello

This is a really nice script! But i have some questions
To add vehicles for, we say group 3, do i do like this?
pawn Код:
AddGroupedVehicle(476,3,-1511.3623,-164.6398,14.8441,11.8009,6,6,true);
And how do i put players in groups?
if OnPlayerSpawn, what do i need to put in here to make members and leader of team 3 be on group 3?
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(Member[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
    }
    if(Leader[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");*/
    }
    return 1;
}
Reply
#14

If the group id of 0 is not valid:
pawn Код:
if(Leader[playerid] > 0) PutPlayerInGroup(playerid, Leader[playerid]);
else if(Member[playerid] > 0) PutPlayerInGroup(playerid, Member[playerid]);
Else:
pawn Код:
if(Leader[playerid] != INVALIDGROUPHERE) PutPlayerInGroup(playerid, Leader[playerid]);
else if(Member[playerid] != INVALIDGROUPHERE) PutPlayerInGroup(playerid, Member[playerid]);
Reply
#15

I will test it later but looks very good.
But at this moment i can't say "Good Job".
Reply
#16

Quote:
Originally Posted by CyNiC
Посмотреть сообщение
If the group id of 0 is not valid:
pawn Код:
if(Leader[playerid] > 0) PutPlayerInGroup(playerid, Leader[playerid]);
else if(Member[playerid] > 0) PutPlayerInGroup(playerid, Member[playerid]);
Else:
pawn Код:
if(Leader[playerid] != INVALIDGROUPHERE) PutPlayerInGroup(playerid, Leader[playerid]);
else if(Member[playerid] != INVALIDGROUPHERE) PutPlayerInGroup(playerid, Member[playerid]);
I cant get this work the way i want, idk if put your code in wrong place?
i have done this for 2 teams of 4
pawn Код:
//TEAM_2 Bluefoxes
    AddGroupedVehicle(476,2,1978.6555,-2396.0037,14.2643,89.5653,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.7040,-2383.6899,14.2553,90.1082,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.8127,-2370.9258,14.2562,89.6564,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.7545,-2358.6887,14.2611,90.8094,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.7524,-2346.6282,14.2542,90.3923,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.7271,-2334.2107,14.2586,89.8635,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1967.9773,-2334.0098,14.2537,89.2006,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1968.0304,-2346.7659,14.2564,89.5600,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1968.0143,-2359.2332,14.2567,89.3761,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1967.8055,-2372.2275,14.2629,89.7649,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1967.7516,-2384.9595,14.2562,89.7772,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1967.9479,-2396.9973,14.2661,90.1868,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1978.8635,-2409.2715,14.2563,89.8173,2,1,true); // Bluefoxes
    AddGroupedVehicle(476,2,1997.4635,-2430.8811,17.1481,94.3798,2,1,true); // Bluefoxes Cargobob
    AddGroupedVehicle(432,2,1978.8031,-2322.4282,13.5596,89.2325,2,1,true); // Bluefoxes Rhino
    AddGroupedVehicle(432,2,1978.6914,-2314.6343,13.5596,89.3591,2,1,true); // Bluefoxes Rhino
    AddGroupedVehicle(432,2,1978.3168,-2306.7822,13.5596,88.8411,2,1,true); // Bluefoxes Rhino
    AddGroupedVehicle(432,2,1978.5193,-2299.1052,13.5598,88.8872,2,1,true); // Bluefoxes Rhino
    AddGroupedVehicle(425,2,1947.4424,-2259.8452,14.1190,182.5776,2,1,true); // hunter bluefoxes
    AddGroupedVehicle(425,2,1931.5741,-2259.7698,14.1187,189.0221,2,1,true); // hunter bluefoxes
    AddGroupedVehicle(425,2,1917.5420,-2262.0669,14.1189,188.7777,2,1,true); // hunter bluefoxes
    AddGroupedVehicle(553,2,1882.8881,-2455.7253,14.8727,271.9742,2,2,true); // Nevada Bomber
    AddGroupedVehicle(553,2,1882.8953,-2425.2107,14.8849,269.5700,2,2,true); // Nevada Bomber
    AddGroupedVehicle(553,2,1882.9893,-2376.3533,14.8969,271.1793,2,2,true); // Nevada Bomber

    //TEAM_3 Thunderbirds
    AddGroupedVehicle(476,3,-1511.3623,-164.6398,14.8441,11.8009,6,6,true); // Thunderbird plane
    AddGroupedVehicle(476,3,-1491.9832,-145.5590,14.8648,11.7777,6,6,true); //Thunderbird
    AddGroupedVehicle(476,3,-1501.6255,-155.3166,14.8596,8.5552,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1481.5931,-135.6380,14.8579,7.9517,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1471.6337,-125.5648,14.8578,8.5159,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1461.9418,-116.3714,14.8641,4.4572,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1451.6680,-105.8881,14.8565,5.1509,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1440.7518,-95.2124,14.8536,3.1080,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1430.0154,-84.5389,14.8576,3.0299,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1418.5612,-73.0776,14.8428,4.4553,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1407.5093,-61.9155,14.8408,5.2833,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1396.1097,-50.7228,14.8596,2.7714,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1385.4530,-39.9416,14.8657,3.3986,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1385.4337,-39.9457,14.8662,3.9818,6,6,true); // Thunderbird
    AddGroupedVehicle(476,3,-1500.4371,-224.0978,18.0048,1.0643,0,0,true);// Thunderbird Cargobob
    AddGroupedVehicle(432,3,-1458.5845,-181.6641,14.1613,76.4453,2,2,true); // Thunderbird Rhino
    AddGroupedVehicle(432,3,-1456.9139,-174.5814,14.1613,75.6198,2,2,true); // Thunderbird Rhino
    AddGroupedVehicle(432,3,-1460.0137,-189.2424,14.1610,77.0195,2,2,true); // Thunderbird Rhino
    AddGroupedVehicle(432,3,-1454.8531,-166.4090,14.1613,76.0108,2,2,true); // Thunderbird Rhino
    AddGroupedVehicle(425,3,-1536.9520,-233.1755,14.7374,10.6363,2,2,true); // Hunter
    AddGroupedVehicle(425,3,-1550.1385,-237.2429,14.7205,13.8028,2,2,true); // Hunter
    AddGroupedVehicle(425,3,-1564.4420,-242.6652,14.7159,5.1001,2,2,true); // Hunter
    AddGroupedVehicle(553,3,-1597.6960,-268.2141,15.4927,46.7468,6,6,true); // Nevada Bomber
    AddGroupedVehicle(553,3,-1618.3346,-289.1963,15.4680,43.8820,6,6,true); // Nevada Bomber
    AddGroupedVehicle(553,3,-1639.6843,-310.1411,15.4752,45.8027,6,6,true); // Nevada Bomber

    if(Leader[playerid] == 2)
    {
        if(Leader[playerid] > 0) PutPlayerInGroup(playerid, Leader[playerid]);
        if(Leader[playerid] != 2) PutPlayerInGroup(playerid, Leader[playerid]);
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");*/
    }
    if(Leader[playerid] == 3)
    {
        if(Leader[playerid] > 0) PutPlayerInGroup(playerid, Leader[playerid]);
        if(Leader[playerid] != 3) PutPlayerInGroup(playerid, Leader[playerid]);
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");*/
    }
If i am in group 2, i can enter group 2 vehicles, and if i make my self leader of team 3 (group 3) i cant enter group 3 vehicles before i reconnect, but still i can enter group 2 vehicles.
Cant figure out how to make this right or what i am doing wrong.
Reply
#17

no more getting the player team then checking if his team id allows him to be in that veh, thanks man.
Reply
#18

looking nice man awesome
Reply
#19

Looks usefull,might use it for my gangs
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)