[Include] [Organisations] Make and use teams/groups/factions/VIP/admin TEAMS easily!!
#1

Hello. If you struggle to make teams or something.. here's a great include for you! It's very easy to use and was easy to make.

Organisations! (v2)
#include <r_orgs>



What's this?

You can create AN organisation (click here for wikipedia) with this include. That is, for example, a member group is an organisation. Then this is an include to help you around with the group's function.

Functions:

pawn Код:
native Org_AddPlayer(playerid, Org_id, level);
native Org_ChangeLevel(playerid, Org_id, level);
native Org_IsPlayerIn(playerid, Org_id);
native Org_CountOnlinePlayers(playerid, Org_id);
native Org_MakeLeader(playerid, Org_id);
native Org_KickOutOf(playerid, Org_id);
native Org_Announce(Org_id, const string[], time, style);
native Org_GiveMoney(Org_id, money);
native Org_SendMessage(Org_id, color, const message[]);
native Org_Teleport(Org_id, Float:x, Float:y, Float:z, interior, vwworld);
native Org_Leave(playerid, Org_id);
native Org_ShowTextDraw(Org_id, Text:textdraw);
native Org_ShowDialog(Org_id, dialogid, style, caption[], info[], button1[], button2[]);
native Org_GiveWeapon(Org_id, weaponid, ammo);
native Org_CreateVehicle(Org_id, vehiclemodel, color);
native Org_PlayAudioStream(Org_id, url[]);
native Org_GetPlayerLevel(playerid, Org_id);
native Org_CreateObjectForAll(Org_id, model_id, Float: x_offset_from_player, Float:y_offset_from_player, Float:z_offset_from_player, Float:rX, Float:rY, Float:rZ, Float: drawdistance = 100);
native Org_DestroyObjectForAll(Org_id);
native Org_Attach3DTextLabelToAll(Org_id, const msg[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ);
native Org_Destroy3DTextLabelForAll(Org_id);
native Org_SetCheckPointForAll(Org_id, Float:x, Float:y, Float:z, Float:size);
native Org_DisableCheckPointForAll(Org_id);
native Org_SetPVarIntForAll(Org_id, varname[], int_value);
native Org_SetPVarFloatForAll(Org_id, varname[], int_value);
native Org_KickAll(Org_id, color, const kick_message[]);
NOTE: YOU NEED TO DEFINE AN ORGANISATION IN ORDER TO USE THESE FUNCTIONS.


Documentation:

I am going to use this organisation for example:
pawn Код:
#define TEAM_VIP 125
Код:
  • native Org_AddPlayer(playerid, Org_id, level);
    This function lets you ADD a player to an organisation.
    Usage: Org_AddPlayer(playerid, TEAM_VIP, 1);
    returns nothing

  • native Org_ChangeLevel(playerid, Org_id, level);
    returns nothing
    This function lets you CHANGE a player's level in an organisation. There is no limit for levels. ( 0 - w/e )
    Usage: Org_ChangeLevel(playerid, TEAM_VIP, 4);
  • native Org_IsPlayerIn(playerid, Org_id);
    This function lets you CHECK if a player is in an organisation.
    Usage: if(Org_IsPlayerIn(playerid, TEAM_VIP) )
    returns true or false
  • native Org_CountOnlinePlayers(Org_id);
    This function lets you COUNT the number of online players in an organisation.
    Usage: new count = Org_CountOnlinePlayers(TEAM_VIP);
    returns the number of online players
  • native Org_MakeLeader(playerid, Org_id);
    This function lets you MAKE a player leader of his organisation and demotes the previous leader.
    Usage: Org_MakeLeader(playerid, TEAM_VIP)
    returns nothing
  • native Org_KickOutOf(playerid, Org_id);
    This function lets you KICK a player out of his organisation.
    Usage: Org_KickOutOf(playerid, TEAM_VIP)
    returns nothing
  • native Org_Announce(Org_id, const string[], time, style);
    This function lets you ANNOUNCE some string to every player of an organisation.
    Usage: Org_Announce(TEAM_VIP, "Hello", 5000, 4)
    returns nothing
  • native Org_GiveMoney(Org_id, money);
    This function lets you GIVE money to every player in an organisation.
    Usage: Org_GiveMoney(TEAM_VIP, 5000);
    returns nothing
  • native Org_SendMessage(Org_id, color, const message[]);
    This function lets you SEND some string to every player of an organisation.
    Usage: Org_SendMessage(TEAM_VIP, -1, "Hello")
    returns nothing
  • native Org_Teleport(Org_id, Float:x, Float:y, Float:z, interior, vwworld);
    This function lets you TELEPORT every player in an organisation to some place.
    Usage: Org_Teleport(TEAM_VIP, 12.24, 125.1, 12.4, 2, 1)
    returns nothing
  • native Org_Leave(playerid, Org_id);
    This function makes a player LEAVE a player out of some organisation. (Same as Kick)
    Usage: Org_Leave(playerid, TEAM_VIP)
    returns nothing
  • native Org_ShowTextDraw(Org_id, Text:textdraw);
    This function lets you SHOW a textdraw to every player of an organisation.
    Usage: Org_ShowTextDraw(TEAM_VIP, Text:my_text)
    returns nothing
  • native Org_ShowDialog(Org_id, dialogid, style, caption[], info[], button1[], button2[]);
    This function lets you SHOW a dialog to every player of an organisation.
    Usage: Org_ShowDialog(TEAM_VIP, DIALOG_LOGIN)
    returns nothing
  • native Org_GiveWeapon(Org_id, weaponid, ammo);
    This function lets you GIVE a weapon to every player of an organisation.
    Usage: Org_GiveWeapon(TEAM_VIP, 31, 999); (Give a M4)
    returns nothing
  • native Org_CreateVehicle(Org_id, vehiclemodel, color);
    This function lets you SPAWN/GIVE/CREATE a vehicle for every player of an organisation.
    Usage: Org_CreateVehicle(TEAM_VIP, 411, 0) (Infernus)
    returns nothing
  • native Org_PlayAudioStream(Org_id, url[]);
    This function plays a URL sound to every player of an organisation.
    Usage: Org_PlayAudioStream(TEAM_VIP, "www.url.com")
    returns nothing
  • native Org_GetPlayerLevel(playerid, Org_id);
    This function gets a player's level.
    Usage: if( Org_GetPlayerLevel(playerid, TEAM_VIP) > 2)...
    returns the level.

    native Org_CreateObjectForAll(Org_id, model_id, Float: x_offset_from_player, Float:y_offset_from_player, Float:z_offset_from_player, Float:rX, Float:rY, Float:rZ, Float: drawdistance = 100);
    This function creates OBJECTS for ALL organisation players' at the offsets from the player.

    native Org_DestroyObjectForAll(Org_id);
    This function disables ALL organisation players' created objects.

    native Org_Attach3DTextLabelToAll(Org_id, const msg[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ);
    This function attaches a text label to ALL organisation players' positions + offsets.

    native Org_Destroy3DTextLabelForAll(Org_id);

    This function disables ALL organisation players' 3D labels.

    native Org_SetCheckPointForAll(Org_id, Float:x, Float:y, Float:z, Float:size);

    This function sets ALL organisation players' checkpoints to co-ordinates specified.

    native Org_DisableCheckPointForAll(Org_id);

    This function disables ALL organisation players' checkpoints to co-ordinates specified.

    native Org_SetPVarIntForAll(Org_id, varname[], int_value);
    This function sets ALL organisation players' PVar to the ones specified.

    native Org_SetPVarFloatForAll(Org_id, varname[], int_value);
    This function sets ALL organisation players' FLOAT PVar to the ones specified.


    native Org_KickAll(Org_id, color, const kick_message[]);
    This function kicks the whole specified organisation out of the server.


Examples of usage:


Group chat:
pawn Код:
public OnPlayerText(playerid, text[])
{
      if(Org_IsPlayerIn(playerid, TEAM_VIP))
      {
          new string[100];
          format(string, 100, "%s says: %s", GetPlayerName(playerid), text);
          return Org_SendMessage(TEAM_VIP, string, -1);
      }
      return 1;
}
Admin system:
pawn Код:
#define ADMIN_TEAM 2112

CMD:makeadmin(..)
{
      Org_AddPlayer(playerid, ADMIN_TEAM);
}
Enjoy!

Download (FIXED WITH MAKE LEADER BUG.)


Keep credits and don't re-release it!

Код:
v1 
Released

v2 
Added functions:
native Org_GetPlayerLevel function
native Org_CreateObjectForAll function
native Org_DestroyObjectForAll function
native Org_Attach3DTextLabelToAll function
native Org_Destroy3DTextLabelForAll function
native Org_SetCheckPointForAll function
native Org_DisableCheckPointForAll function
native Org_SetPVarIntForAll function
native Org_SetPVarFloatForAll function
native Org_KickAll function

Fixed leader bug
Renamed functions from Organisation_ to Org_
Reply
#2

Pretty useful, thanks for sharing.
Reply
#3

Okay now this stuff is EPIC
Good Job dude.
Reply
#4

Thanks guys. Please suggest stuff to make this better and report bugs. Also forgot to mention - you can make your COPS vs ROBBERS gamemode with this too! Define TEAM COP & TEAM ROBBER, then check while arresting or robbing, and so on! Cheers.
Reply
#5

Why would anyone use this inefficient "include" over y_groups?
Reply
#6

Personally, I find y_groups unhelpful, not user friendly and except sscanf, I don't use YSI. If you were to want some basic and not being handed the whole script to you - you would use my include. In no way is mine better than y_groups, but I am sure mine is easier to integrate in a gamemode than y_groups. It's a choice of yours, use it or don't! Anyways, thanks for that!
Reply
#7

Simple, nice and easy - love it. But I've one suggestion - add a shortcut name for the "organization_something" - for example: "org_something" will be easier to remember.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
1) Unhelpful in what way?

2) This very include uses YSI...

3) The topic states that you can create admin levels, factions, teams and other "organisations" but you can only be in one at once - they're all mutually exclusive. Most people have an admin system AND a faction system (or whatever) because admins can still be in teams. How do you replicate that situation with this include? Edit: ignore that, I just saw you imposed an artificial limit on organisations of 10 (except for leaders - it seems if someone is a leader of any organisation they are the leader of them all).
I was so expecting that! Do not be offended or something, but that is just my personal opinion.
1) IMHO, to use YSI is difficult for me - I don't like the way it needs to have a lot of set up and is kind of difficult to integrate in a script.
2) Of course! - unless you'd rather I use the ALS hooking method or ask everyone to type a callback somewhere? I said I AVOID using it as far as I can!
3) I have used a bool array, which means they are just the leader of that organisation. Am I right?

Quote:
Originally Posted by Dystans
Посмотреть сообщение
Simple, nice and easy - love it. But I've one suggestion - add a shortcut name for the "organization_something" - for example: "org_something" will be easier to remember.
Thank you very much! And of course, I shall.
Reply
#9

Sweet mother of jesus! I have USED a boolean array though I forgot to declare it as an array. Should have given me an error! How come it didn't - as I was accessing an array in a single boolean! But nevermind. Would any moderator be kind enough to fix it and reupload it or just remove the download until I can fix it? I need to add only [10] after leader. Cheers. Thanks for that, Y Less.

EDIT: FIXED AND re uploaded the CORRECT link.
Re - named all functions from "Organisation_.." to "Org_".
Reply
#10

Added many more functions - now there are TOTAL 26 functions! Fixed bugs. Now you can manipulate with the organisation players - you can manage their - objects, 3D Text labels, dialogs, money, weapons, vehicles, position, levels, textdraws, audio streams, checkpoints and PVars! I hope it's useful to some!
Reply
#11

1 question, how is this related with anything on making an administrator system? u_u
Reply
#12

You can use this to make an admin system. Example:
pawn Код:
#define TEAM_ADMIN

CMD:makeadmin(..)
{
      Org_AddPlayer(targetid, TEAM_ADMIN);
}

CMD:kick(..)
{
      if(!Org_IsPlayerIn(playerid, TEAM_ADMIN) return SendClientMessage(.. " You are NOT an admin!");
}


public OnPlayerText(playerid, text[])
{
      new string[128];
      if(Org_IsPlayerIn(playerid, TEAM_ADMIN)
      {
           if(text[0] == '@')
           {
                format(string, 128, "%s says: %s", GetPlayerName(playerid), text);
                Org_SendMessageToAll(TEAM_ADMIN, color, string);
           }
     }
}
Etc, you can make use of the functions available..
Reply
#13

I suggest to make this not supported to make administrator systems, because you're trying to pull off a system with 2/3 "normal" administrator commands. Either you balance commands for all groups, or remove groups to have the commands balanced within the groups.
Reply
#14

Quote:
Originally Posted by Sublime
Посмотреть сообщение
I suggest to make this not supported to make administrator systems, because you're trying to pull off a system with 2/3 "normal" administrator commands. Either you balance commands for all groups, or remove groups to have the commands balanced within the groups.
This include is for managing organisations, I have not focused on any one team specifically. It's your choice what organisation you use it for! Since an admin team passes as an organisation - there you are. If you need any more functions - please suggest - I'll be more than happy to provide.
Reply
#15

An admin team is not an organisation n_n

EDIT : Adding pay check with pay check edits for each group would be nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)