Код:
/*
DYNAMIC ORGANIZATIONS FILTERSCRIPT
CODED FROM SCRATCH BY JAKKU
COPYRIGHT © 2011 - 2012
RELEASE DATE: 15/12/2011
PLEASE REPORT ALL BUGS (If found) @ SA-MP FORUMS - https://sampforum.blast.hk/showthread.php?tid=303864
Feel free to edit this script, but DO NOT REMOVE THE CREDITS! I have used time to code this system and give it to you for FREE!
It isn't much asked to keep the credits in it!
*/
/*
Changelog v.2
- CreateOrganizationZone can be used to create coloured "gangzones" for orgs
- IsPlayerInOrgZone(playerid, orgname)
- SendClientMessageToOrg(orgname, color, message)
- Fixed some small bugs, nothing serious
- Added auto-save for player stats and org. leaders (45sec delay)
- Added /decline command for leaders to decline incoming requests
*/
#include <a_samp>
#include <Dini>
#include <sscanf2>
#include <zcmd>
//Color defines
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000FF
#define COLOR_GROVE 0x00FF00AA
#define COLOR_BALLAS 0xC2A2DAAA
#define COLOR_AZTECAS 0x0064FFAA
#define COLOR_SAPD 0x2641FEAA
#define COLOR_SAAF 0xFFFF00AA
#define COLOR_SAH 0xFF0000FF
#define LIGHTGREEN 0x38FF06FF
#define LIGHTBLUE2 0xF6BB0AA
#define LIGHTBLUE 0x0BBF6AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_BLACK 0x000000AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN1 0x33AA33AA
#define COLOR_BROWN 0xA52A2AAA
#define blue 0x375FFFFF
#define BlueMsg 0x0BBF6AA
#define white 0xFFFFFFAA
#define red 0xFF0000AA
#define lightred 0xFB0000AA
#define green 0x33FF33AA
#define yellow 0xFFFF00AA
#define grey 0xC0C0C0AA
#define Green1 0x129E12FF
#define Green2 0x53D212FF
#define blue1 0x2641FEAA
#define orange 0xFF9900AA
#define black 0x2C2727AA
//-------------- EDIT BELOW THIS LINE --------------
#define COLOR_KILLED 0x880000FF //The color, when a player gets killed by tazing
#define COLOR_ERROR 0xFF0000AA //The color of the message, when an error occurs
#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define STUNNED_TIME 4 //The time in seconds the stun lasts
#define ANTISPAM 5 //The minimum allowed time between /taze commands
//-----------------NO NEED TO EDIT BELOW THIS LINE ---------------------
new Jail1[MAX_PLAYERS];
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
// Defines
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//==============================================================================
//------------------DCMD---------------------
//
new stunned[MAX_PLAYERS];
new tazetime[MAX_PLAYERS];
#define WAGE 1200 //Define the wage here
#define MAX_ORGS 18 //Change only if you need more than 10 orgs
#define MAX_ORG_WEAPONS 3 //Max amount of weapons for orgs
#define ORG_NAME_LENGTH 64 //Max name length for organization and it's leader
#define MAX_ORG_VEHICLES 10
#define MAX_ZONES_PER_ORG 3
#define SAVE_LEADERS_TO "org_leaders.txt"
// Script configuration
#define SPAWN_WITH_ORG_SKIN //Comment this line IF YOU DON'T WANT THE PLAYERS SPAWN WITH ORGANIZATION SKIN!
//#define ENABLE_HQ_TELE //Comment this line IF YOU WANT TO DISABLE /teletohq
//
forward PayDay();
forward CheckArea();
forward AutoSave();
new OrgsCount;
new ZoneCount;
enum Orgs
{
Name[32],
Leader[24],
Skin,
Float:X,
Float:Y,
Float:Z,
Weapons[3],
Ammo[3],
Vehicles[MAX_ORG_VEHICLES],
VehiclesCreated,
Text3D:OrgLabel,
Zones[MAX_ZONES_PER_ORG],
Float:ZoneMinX[MAX_ZONES_PER_ORG],
Float:ZoneMinY[MAX_ZONES_PER_ORG],
Float:ZoneMaxX[MAX_ZONES_PER_ORG],
Float:ZoneMaxY[MAX_ZONES_PER_ORG],
ZoneColor[MAX_ZONES_PER_ORG],
ZonesCreated,
};
new Organization[MAX_ORGS][Orgs];
new PlayerOrg[MAX_PLAYERS];
new PlayerLeader[MAX_PLAYERS];
new PlayerRank[MAX_PLAYERS][28];
new Requesting[MAX_PLAYERS];
new CollectedWage[MAX_PLAYERS];
new name;
new player1;
new Grove;
new Ballas;
new Aztecas;
new SAPD;
new SAAF;
new SAH;
new lvpd1;
new lvpd2;
new lvpd3;
public OnFilterScriptInit()
{
//---== Las Venturas Police Department (I made it in a 20-30min so its not so good lol) ==---
lvpd1 = CreateObject(969,2237.421,2449.144,9.838,0.0,0.0,90.000); // LVPD Outer Gate
lvpd2 = CreateObject(971,2293.847,2498.374,5.768,0.0,0.0,-90.000); // LVPD Garage Gate #1
lvpd3 = CreateObject(971,2335.227,2443.460,8.261,0.0,0.0,59.688); // LVPD Garage Gate #2
CreateObject(1495,2293.849,2494.456,2.255,0.0,0.0,-90.859);
print("\n--------------------------------------");
print("==Dynamic organization filterscript by Jakku - initialized!==");
print("==© 2011 - 2012==");
print("--------------------------------------\n");
CreatePickup(1239,1,2459.3740,-1690.8842,13.5464,0);
CreatePickup(1239,1,1905.9891,-1113.5447,26.6641,0);
CreatePickup(1239,1,1882.8102,-2016.0778,13.5469,0);
CreatePickup(1239,1,1553.2577,-1675.4991,16.1953,0);
CreatePickup(1239,1,213.4593,1869.0469,13.1406,0);
CreatePickup(1239,1,-2650.2827,634.9139,14.4531,0);
SetTimer("PayDay",1500000,1); //PayDay every 25 minutes
SetTimer("CheckArea",1000,1);
SetTimer("AutoSave",45000,1);
/*
ALWAYS add your organization BELOW the old one, otherwise the IDs will change = leaders mix up ! ! ! ! !
Syntax for CreateOrganization: CreateOrganization(name[32], skin, Float:x,Float:y,Float:z, wp1,a1,wp2,a2,wp3,a3)
Syntax for CreateOrgVehicle: CreateOrgVehicle(orgname[32], modelid, Float:x,Float:y,Float:z,Float:rotation, color1,color2)
Syntax for CreateOrganizationZone: CreateOrganizationZone(orgname[32], Float:minx,Float:miny,Float:maxx,Float:maxy, color)
*/
//Create ORGS here:
Grove = CreateOrganization("GroveStreetFamilies", 106, 2459.3740,-1690.8842,13.5464, 5,1,22,200,28,200);
Ballas = CreateOrganization("Ballas", 102, 1905.9891,-1113.5447,26.6641, 5,1,22,200,32,200);
Aztecas = CreateOrganization("LosAztecas", 116, 1882.8102,-2016.0778,13.5469, 4,1,22,200,28,200);
SAPD = CreateOrganization("SanAndreasPoliceDept.", 280, 1553.2577,-1675.4991,16.1953, 3,1,22,200,16,3);
SAAF = CreateOrganization("SanAndreasArmedForces", 287, 213.4593,1869.0469,13.1406, 4,1,24,200,31,200);
SAH = CreateOrganization("SanAndreasHospital", 274, -2650.2827,634.9139,14.4531, 4,1,22,200,17,5);
//
//Create ORG VEHICLES here:
CreateOrgVehicle("GroveStreetFamilies", 567, 2486.3179,-1654.5002,13.4875,269.1353, 86,86);
CreateOrgVehicle("GroveStreetFamilies", 567, 2493.2654,-1683.5913,13.5099,89.9716, 86,86);
CreateOrgVehicle("GroveStreetFamilies", 536, 2443.1409,-1644.7314,13.5621,178.7729, 86,86);
CreateOrgVehicle("GroveStreetFamilies", 412, 2458.8721,-1653.8367,13.4578,88.6591, 86,86);
CreateOrgVehicle("GroveStreetFamilies", 475, 2469.2314,-1670.5446,13.4859,7.1732, 86,86);
CreateOrgVehicle("GroveStreetFamilies", 482, 2473.4587,-1695.0333,13.6080,0.5430, 86,86);
CreateOrgVehicle("Ballas", 566, 1910.6688,-1117.2758,25.7699,179.2417, 22,22);
CreateOrgVehicle("Ballas", 567, 1896.1436,-1130.7200,24.3846,91.8288, 22,22);
CreateOrgVehicle("Ballas", 536, 1916.8153,-1140.4926,24.9021,269.4394, 22,22);
CreateOrgVehicle("Ballas", 482, 1948.4398,-1130.8833,25.6983,272.0282, 22,22);
CreateOrgVehicle("Ballas", 475, 1898.3131,-1140.4404,24.4392,90.9452, 22,22);
CreateOrgVehicle("LosAztecas", 536, 1878.0626,-2038.5837,13.5565,180.7777, 2,2);
CreateOrgVehicle("LosAztecas", 482, 1866.7059,-2030.8900,13.6392,271.2329, 2,2);
CreateOrgVehicle("LosAztecas", 468, 1897.9601,-2008.9556,13.6392,89.1157, 2,2);
CreateOrgVehicle("LosAztecas", 468, 1898.0280,-2005.9056,13.6393,90.9175, 2,2);
CreateOrgVehicle("LosAztecas", 475, 1887.8726,-2024.9139,13.5527,0.9749, 2,2);
CreateOrgVehicle("LosAztecas", 536, 1887.4788,-2034.4155,13.5531,179.1819, 2,2);
CreateOrgVehicle("LosAztecas", 482, 1902.1213,-2031.0815,13.6392,89.0179, 2,2);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1601.7631,-1684.0145,5.9830,91.3660, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1602.1550,-1695.9111,5.9830,88.9941, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 523, 1584.5035,-1671.5638,5.9853,269.7377, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 427, 1591.3566,-1711.5468,5.9829,358.8260, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1574.6061,-1710.6648,5.9830,359.9703, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1545.2388,-1663.0413,5.9830,87.9600, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 523, 1538.6840,-1644.4974,5.9829,178.6834, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 427, 1528.6517,-1683.7592,5.9829,270.7598, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1534.2266,-1658.3682,13.5520,179.6692, 0,1);
CreateOrgVehicle("SanAndreasPoliceDept.", 596, 1534.1841,-1688.5201,13.5519,180.0468, 0,1);
CreateOrgVehicle("SanAndreasArmedForces", 432, 275.6552,2023.3647,17.7329,273.4136, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 432, 273.4011,1988.5979,17.7331,271.9744, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 432, 274.1869,1956.0293,17.7329,267.7083, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 470, 226.8924,1888.5497,17.7330,3.3656, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 470, 201.0364,1893.0643,17.7385,358.9102, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 420, 275.2824,1931.1484,17.7330,268.6616, 0,0);
CreateOrgVehicle("SanAndreasArmedForces", 433, 345.4694,1987.2467,17.7329,92.0023, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 425, 344.3755,1956.1711,17.7328,91.8767, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 433, 344.2848,1925.3082,17.7330,85.7764, 43,0);
CreateOrgVehicle("SanAndreasArmedForces", 548, 306.1154,1894.5288,17.7330,179.9825, 43,0);
CreateOrgVehicle("SanAndreasHospital", 416, -2619.5330,608.3016,14.5455,179.5224, 0,0);
CreateOrgVehicle("SanAndreasHospital", 416, -2663.6960,636.3392,14.5454,180.7595, 0,0);
CreateOrgVehicle("SanAndreasHospital", 416, -2681.2666,607.3167,14.5455,179.7717, 0,0);
//
//Create ORG ZONES here:
CreateOrganizationZone("GroveStreetFamilies", 2370.7905,-1735.6218,2568.8491,-1615.8931, COLOR_GROVE);
//
LoadLeaders(); //This MUST BE executed AFTER the organizations are being created!
new pcount = 0;
for (new playerid = 0;playerid<MAX_PLAYERS;playerid++)
{
if (IsPlayerConnected(playerid))
{
LoadPlayerOrgInfo(playerid);
pcount++;
}
}
if (pcount > 0)
{
printf("==Dynamic organization filterscript by Jakku reloaded!==");
printf("==Data loaded for %d connected players==", pcount);
}
return 1;
}
public PayDay()
{
for (new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
if (PlayerOrg[i] != 0)
{
new string[80];
format(string, sizeof(string),"You have earned $%d from your org.", WAGE);
SendClientMessage(i, COLOR_GREY, string);
CollectedWage[i]+=WAGE;
SavePlayerOrgInfo(i);
}
}
}
}
public AutoSave()
{
for (new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
SavePlayerOrgInfo(i);
}
}
SaveLeaders();
}
public CheckArea()
{
for (new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
new count,name[32];
for (new c=1;c<OrgsCount+1;c++)
{
if (DoesOrgExist(GetOrgName©))
{
for (new a=1;a<Organization[c][ZonesCreated]+1;a++)
{
if (IsPlayerInArea(i, Organization[c][ZoneMinX][a],Organization[c][ZoneMinY][a],Organization[c][ZoneMaxX][a],Organization[c][ZoneMaxY][a]))
{
count++;
name = GetOrgName©;
}
}
}
}
if (count != 0)
{
if (GetPVarInt(i, "IsInOrgZone") == 0)
{
new string[120];
if (PlayerOrg[i] == GetOrgID(name))
{
format(string,sizeof(string),"Welcome to your organization's zone!");
}
else
{
format(string,sizeof(string),"You are now in {5CB3FF}%s's{FFFFFF} zone!", name);
}
SendClientMessage(i, COLOR_WHITE, string);
SetPVarInt(i, "IsInOrgZone", 1);
return 1;
}
}
else
{
SetPVarInt(i, "IsInOrgZone", 0);
}
}
}
return 1;
}
public OnFilterScriptExit()
{
print("Thank you for using Jakku's Dynamic organizations- filterscript");
print("© 2011 - 2012");
for (new i=1;i<OrgsCount+1;i++)
{
for (new a=0;a<MAX_ORG_VEHICLES;a++)
{
if (IsVehicleConnected(Organization[i][Vehicles][a]))
{
DestroyVehicle(Organization[i][Vehicles][a]);
}
}
Delete3DTextLabel(Organization[i][OrgLabel]);
}
for (new playerid = 0;playerid<MAX_PLAYERS;playerid++)
{
if (IsPlayerConnected(playerid))
{
SavePlayerOrgInfo(playerid);
}
}
SaveLeaders();
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerOrg[playerid] = 0; //Resetting player org
PlayerLeader[playerid] = 0; //Resetting player org leader status
Requesting[playerid] = 0;
CollectedWage[playerid] = 0;
PlayerRank[playerid] = "None";
if(!dini_Exists(PlayerPath(playerid))) //Creating file (check stock PlayerPath(playerid) )
{
SendClientMessage(playerid, COLOR_ORANGE,"As this is your first visit here, we decided to tell you that this server is using Dynamic organization- script by Jakku");
dini_Create(PlayerPath(playerid));
}
else
{
LoadPlayerOrgInfo(playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SavePlayerOrgInfo(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
if (PlayerOrg[playerid] != 0)
{
if (GetPVarInt(playerid, "Dead") == 0)
{
new string[160];
new leader[4];
if (IsLeader(playerid)) leader = "Yes";
else leader = "No";
format(string,sizeof(string),"Organization: {5CB3FF}%s {FFFFFF}|| Leader: {5CB3FF}%s {FFFFFF}|| Rank: {5CB3FF}%s", GetOrgName(PlayerOrg[playerid]), leader, PlayerRank[playerid]);
SendClientMessage(playerid, COLOR_WHITE, string);
GiveOrgFeatures(playerid);
}
}
SetPVarInt(playerid, "Dead", 0);
for (new i=1;i<OrgsCount+1;i++)
{
for (new a=1;a<Organization[i][ZonesCreated]+1;a++)
{
GangZoneShowForPlayer(playerid, Organization[i][Zones][a], Organization[i][ZoneColor][a]);
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPVarInt(playerid, "Dead", 1);
if(GetPlayerWantedLevel(playerid))
{
SendClientMessage(playerid,COLOR_RED,"We don't care if you are dead by an accident or by a cop, but the cops caught you");
SendClientMessage(playerid,COLOR_RED,"(( We mean if you are dead by cop then you are caught absoulutely");
SendClientMessage(playerid,COLOR_RED,"(( but if you are death, you went to hospital and the cops just caught you))");
SetPlayerPos(playerid,0,0,0);
Jail1[playerid] = SetTimerEx("Jail",180000,0, "i", playerid);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(cuff, 4, cmdtext);
dcmd(uncuff, 4, cmdtext);
dcmd(jail, 4, cmdtext);
dcmd(taze, 4, cmdtext);
if (strcmp("/clvpd1", cmdtext, true) == 0)
{
MoveObject(lvpd1, 2237.421,2449.144,9.838, 5);
SendClientMessage(playerid, COLOR_RED, "LVPD Gate Closed !");
return 1;
}
if (strcmp("/olvpd2", cmdtext, true) == 0)
{
MoveObject(lvpd2, 2293.847,2498.354,10.518, 5);
SendClientMessage(playerid, COLOR_RED, "LVPD Gate Opened !");
return 1;
}
if (strcmp("/clvpd2", cmdtext, true) == 0)
{
MoveObject(lvpd2, 2293.847,2498.374,5.768, 5);
SendClientMessage(playerid, COLOR_RED, "LVPD Gate Closed !");
return 1;
}
if (strcmp("/olvpd3", cmdtext, true) == 0)
{
MoveObject(lvpd3, 2335.170,2443.313,1.311, 5);
SendClientMessage(playerid, COLOR_RED, "LVPD Gate Opened !");
return 1;
}
if (strcmp("/clvpd3", cmdtext, true) == 0)
{
MoveObject(lvpd3, 2335.227,2443.460,8.261, 5);
SendClientMessage(playerid, COLOR_RED, "LVPD Gate Closed !");
return 1;
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 756 && response)
{
switch (listitem)
{
case 0:
{
for (new i=1;i<OrgsCount+1;i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3.0, Organization[i][X], Organization[i][Y],Organization[i][Z]))
{
new string[140];
format(string,sizeof(string),"{5CB3FF}Organization: {FFFFFF}%s\n{5CB3FF}Leader: {FFFFFF}%s", GetOrgName(i), Organization[i][Leader]);
ShowPlayerDialog(playerid, 757, DIALOG_STYLE_MSGBOX, "Organization",string,"Close","");
return 1;
}
}
}
case 1:
{
if (CollectedWage[playerid] <= 0) return SendClientMessage(playerid, COLOR_RED, "You don't have any wage earned yet!");
new string[80];
format(string,sizeof(string),"You have collected $%d", CollectedWage[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, string);
GivePlayerMoney(playerid, CollectedWage[playerid]);
CollectedWage[playerid] = 0;
SavePlayerOrgInfo(playerid);
}
}
}
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
for (new i=1;i<OrgsCount+1;i++)
{
for (new a=0;a<MAX_ORG_VEHICLES;a++)
{
new vehicleid = GetPlayerVehicleID(playerid);
if (IsVehicleConnected(vehicleid))
{
if (vehicleid == Organization[i][Vehicles][a] && PlayerOrg[playerid] != i)
{
if (DoesOrgExist(GetOrgName(i)))
{
new string[100];
format(string,sizeof(string),"This vehicle belongs to %s. You are not authorized to use it", GetOrgName(i));
SendClientMessage(playerid, COLOR_RED, string);
RemovePlayerFromVehicle(playerid);
}
}
}
}
}
}
return 1;
}
stock PlayerName(playerid)
{
new playername[24];
GetPlayerName(playerid, playername, 24);
return playername;
}
stock CreateOrganization(name[32], skin, Float:x,Float:y,Float:z, wp1 = 0,a1 = 0,wp2 = 0,a2 = 0,wp3 = 0,a3 = 0)
{
OrgsCount++;
if (OrgsCount >= MAX_ORGS) return printf("You have exceeded the MAX_ORGS- define! Aborted");
new id = OrgsCount;
Organization[id][Name] = name;
Organization[id][Skin] = skin;
Organization[id][X] = x;
Organization[id][Y] = y;
Organization[id][Z] = z;
Organization[id][Weapons][0] = wp1;
Organization[id][Ammo][0] = a1;
Organization[id][Weapons][1] = wp2;
Organization[id][Ammo][1] = a2;
Organization[id][Weapons][2] = wp3;
Organization[id][Ammo][2] = a3;
printf("Organization created: ID: %d || Name: %s",id, name);
new string[100];
format(string,sizeof(string),"{5CB3FF}HQ:{FFFFFF} %s\nType {5CB3FF}/org{FFFFFF} for more information!",name);
Organization[id][OrgLabel] = Create3DTextLabel(string, 0x008080FF, x, y, z, 25.0, 0);
return 1;
}
stock PlayerPath(playerid)
{
new path[45];
format(path, sizeof(path),"Orginfo_%s.ini", PlayerName(playerid));
return path;
}
stock SaveLeaders()
{
new part[40];
if (!dini_Exists(SAVE_LEADERS_TO))
{
dini_Create(SAVE_LEADERS_TO);
}
for (new i=1;i<OrgsCount+1;i++)
{
format(part,sizeof(part),"%d", i);
dini_Set(SAVE_LEADERS_TO,part,Organization[i][Leader]);
}
}
stock LoadLeaders()
{
new part[24];
new part2[40];
if (!dini_Exists(SAVE_LEADERS_TO))
{
for (new i=1;i<OrgsCount+1;i++)
{
dini_Create(SAVE_LEADERS_TO);
format(part,sizeof(part),"None");
Organization[i][Leader] = part;
SaveLeaders();
}
return 1;
}
for (new i=1;i<OrgsCount+1;i++)
{
format(part2,sizeof(part2),"%d", i);
format(part,sizeof(part),dini_Get(SAVE_LEADERS_TO,part2));
if (strcmp(part," ", false) == 0)
{
part = "None";
}
Organization[i][Leader] = part;
}
return 1;
}
stock SavePlayerOrgInfo(playerid)
{
if (!dini_Exists(PlayerPath(playerid)))
{
dini_Create(PlayerPath(playerid));
}
//dini_Set(savef,"ContactName1",ContactNames[0][playerid]);
dini_Set(PlayerPath(playerid),"Org",Organization[PlayerOrg[playerid]][Name]);
dini_Set(PlayerPath(playerid),"Rank",PlayerRank[playerid]);
dini_IntSet(PlayerPath(playerid),"CollectedWage",CollectedWage[playerid]);
}
stock LoadPlayerOrgInfo(playerid)
{
new string[45];
format(string,sizeof(string),"%s",dini_Get(PlayerPath(playerid),"Org"));
PlayerOrg[playerid] = GetOrgID(string);
new string2[28];
format(string2,sizeof(string2),"%s",dini_Get(PlayerPath(playerid),"Rank"));
PlayerRank[playerid] = string2;
CollectedWage[playerid] = dini_Int(PlayerPath(playerid), "CollectedWage");
if (strcmp(Organization[PlayerOrg[playerid]][Leader], PlayerName(playerid),true) == 0 && PlayerOrg[playerid] != 0)
{
PlayerLeader[playerid] = 1;
}
}
stock GiveOrgFeatures(playerid)
{
new org = PlayerOrg[playerid];
if (!org) return 1;
GivePlayerWeapon(playerid, Organization[org][Weapons][0],Organization[org][Ammo][0]);
GivePlayerWeapon(playerid, Organization[org][Weapons][1],Organization[org][Ammo][1]);
GivePlayerWeapon(playerid, Organization[org][Weapons][2],Organization[org][Ammo][2]);
#if defined SPAWN_WITH_ORG_SKIN
SetPlayerSkin(playerid, Organization[org][Skin]);
#endif
return 1;
}
stock GetOrgName(orgid)
{
new name[32];
format(name,sizeof(name),"%s",Organization[orgid][Name]);
if (orgid == 0) format(name,sizeof(name),"None");
return name;
}
stock SendClientMessageToAllEx(exception, clr, const message[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(i != exception)
{
SendClientMessage(i, clr, message);
}
}
}
}
stock ResetPlayerOrg(playerid)
{
if (PlayerOrg[playerid] == 0) return 1;
printf("%s has been removed from %s", PlayerName(playerid), GetOrgName(PlayerOrg[playerid]));
SetPlayerSkin(playerid, 0);
ResetPlayerWeapons(playerid);
PlayerOrg[playerid] = 0;
Requesting[playerid] = 0;
PlayerLeader[playerid] = 0;
return 1;
}
CMD:imasu(playerid, params[])
{
#pragma unused params
if (PlayerOrg[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a member of an organization");
ShowPlayerDialog(playerid, 755, DIALOG_STYLE_MSGBOX, "{FFFFFF}Are you sure you want to resign?","{FFFFFF}Please {00FF00}confirm {FFFFFF}your resignation request","Resign","Cancel");
return 1;
}
CMD:oc(playerid, params[])
{
if (PlayerOrg[playerid] == 0) return SendClientMessage(playerid, COLOR_RED,"You are not a member of an organization");
new text[100];
if (sscanf(params, "s[100]", text)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /ochat [message]");
new org = PlayerOrg[playerid];
new string[128];
format(string,sizeof(string),"{5CB3FF}(Org Chat) {FFFFFF}(%s): %s", PlayerName(playerid), text);
SendClientMessageToOrg(GetOrgName(org), COLOR_WHITE, string);
return 1;
}
CMD:teletohq(playerid, params[])
{
#pragma unused params
#if defined ENABLE_HQ_TELE
if (PlayerOrg[playerid] == 0) return SendClientMessage(playerid, COLOR_RED,"You are not a member of an organization");
if (IsPlayerInRangeOfPoint(playerid, 10.0,Organization[PlayerOrg[playerid]][X],Organization[PlayerOrg[playerid]][Y],Organization[PlayerOrg[playerid]][Z]))
{
SendClientMessage(playerid, COLOR_RED,"You are already close to your HQ!");
return 1;
}
SetPlayerPos(playerid, Organization[PlayerOrg[playerid]][X],Organization[PlayerOrg[playerid]][Y],Organization[PlayerOrg[playerid]][Z]);
SendClientMessage(playerid, COLOR_YELLOW,"You have teleported to your HQ");
#else
SendClientMessage(playerid, COLOR_RED,"This feature has been disabled");
#endif
return 1;
}
CMD:ovres(playerid, params[])
{
#pragma unused params
if (!IsLeader(playerid)) return SendClientMessage(playerid, COLOR_RED,"You are not the leader of an organization!");
new org = PlayerOrg[playerid];
if (Organization[org][VehiclesCreated] <= 0) return SendClientMessage(playerid, COLOR_RED,"There are no vehicles created for your org!");
SendClientMessage(playerid, COLOR_YELLOW,"You have respawned your org. vehicles!");
for (new i=0;i<MAX_ORG_VEHICLES;i++)
{
if (IsVehicleConnected(Organization[org][Vehicles][i]))
{
SetVehicleToRespawn(Organization[org][Vehicles][i]);
}
}
return 1;
}
CMD:org(playerid, params[])
{
#pragma unused params
for (new i=1;i<OrgsCount+1;i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3.0, Organization[i][X],Organization[i][Y],Organization[i][Z]))
{
new string[35];
new string2[80];
format(string, sizeof(string),"%s", GetOrgName(i));
format(string2, sizeof(string2),"Information");
if (PlayerOrg[playerid] == i) format(string2, sizeof(string2),"Information\nCollect Wage");
ShowPlayerDialog(playerid, 756, DIALOG_STYLE_LIST, string,string2,"Ok","Cancel");
return 1;
}
}
SendClientMessage(playerid, COLOR_RED,"You are not close enough to an organization!");
return 1;
}
CMD:setmember(playerid, params[])
{
if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization");
new ID;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setmember [playerid]");
if (!IsPlayerConnected(ID) || ID == playerid) return 1;
new org = PlayerOrg[playerid];
if (PlayerOrg[ID]) return SendClientMessage(playerid, COLOR_RED,"That player already belongs to an organization");
if (Requesting[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player is not requesting to join your organization!");
new string[120];
format(string,sizeof(string),"%s has set you as a member of %s", PlayerName(playerid), GetOrgName(org));
SendClientMessage(ID, COLOR_YELLOW, string);
format(string,sizeof(string),"You have set %s a member of %s", PlayerName(ID), GetOrgName(org));
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerOrg[ID] = org;
GiveOrgFeatures(ID);
Requesting[ID] = 0;
return 1;
}
CMD:setleader(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You must be logged into RCON to use this command!");
new ID,orgid;
if (sscanf(params, "ud", ID,orgid)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setleader [playerid] [orgid]");
if (!IsPlayerConnected(ID)) return 1;
if (PlayerOrg[ID]) return SendClientMessage(playerid, COLOR_RED,"That player already belongs to an organization");
if (orgid < 1 || orgid > OrgsCount) return SendClientMessage(playerid, COLOR_RED,"Invalid org. ID!");
new string[140];
format(string,sizeof(string),"An admin %s has set you as the leader of %s", PlayerName(playerid), GetOrgName(orgid));
SendClientMessage(ID, COLOR_YELLOW, string);
format(string,sizeof(string),"You have set %s the leader of %s", PlayerName(ID), GetOrgName(orgid));
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerOrg[ID] = orgid;
PlayerLeader[ID] = 1;
Organization[orgid][Leader] = PlayerName(ID);
SaveLeaders();
SavePlayerOrgInfo(ID);
GiveOrgFeatures(ID);
return 1;
}
CMD:setrank(playerid, params[])
{
if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization");
new ID, rank[28];
if (sscanf(params, "us[28]", ID, rank)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setrank [playerid] [rank]");
if (strlen(rank) > 28) return SendClientMessage(playerid, COLOR_RED,"The maximum rank length is 28 characters!");
if (!IsPlayerConnected(ID)) return 1;
new org = PlayerOrg[playerid];
if (PlayerOrg[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player does not belong to your organization");
new string[120];
format(string,sizeof(string),"Your leader %s has given you a rank: '%s'", PlayerName(playerid), rank);
SendClientMessage(ID, COLOR_YELLOW, string);
format(string,sizeof(string),"You have given a rank to %s (%s)", PlayerName(ID), rank);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerRank[ID] = rank;
SavePlayerOrgInfo(ID);
return 1;
}
CMD:kickmember(playerid, params[])
{
if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization");
new ID;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /kickmember [playerid]");
if (!IsPlayerConnected(ID) || ID == playerid) return 1;
new org = PlayerOrg[playerid];
if (PlayerOrg[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player does not belong to your organization");
new string[130];
format(string,sizeof(string),"%s has kicked you from %s", PlayerName(playerid), GetOrgName(org));
SendClientMessage(ID, COLOR_YELLOW, string);
format(string,sizeof(string),"You have kicked %s from %s", PlayerName(ID), GetOrgName(org));
SendClientMessage(playerid, COLOR_YELLOW, string);
ResetPlayerOrg(ID);
return 1;
}
CMD:pcmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 4)
SendClientMessage(playerid,COLOR_RED,"/taze, /jail, /uncuff, /cuff, /olvpd1 , /olvpd2 , /olvpd3 , /clvpd1 , /clvpd2 , /clvpd3");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:gcmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 1)
SendClientMessage(playerid,COLOR_RED,"/robbank, /tie, /rob, /rape, /untie (Important roleplay commands)");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:bcmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 2)
SendClientMessage(playerid,COLOR_RED,"/robbank, /tie, /rob, /rape, /untie (Important roleplay commands)");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:acmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 3)
SendClientMessage(playerid,COLOR_RED,"/robbank, /tie, /rob, /rape, /untie (Important roleplay commands)");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:saafcmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 5)
SendClientMessage(playerid,COLOR_RED,"/taze, /jail, /uncuff, /cuff, /olvpd1 , /olvpd2 , /olvpd3 , /clvpd1 , /clvpd2 , /clvpd3");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:sahcmds(playerid, params[])
{
if(PlayerOrg[playerid] > 0)
{
if(PlayerOrg[playerid] > 6)
SendClientMessage(playerid,COLOR_RED,"Only 1 command /heal but made a good interior inside the ambulance");
SendClientMessage(playerid,COLOR_RED,"Other commands view from this, /orghelp");
}
return 1;
}
CMD:request(playerid, params[])
{
if (PlayerOrg[playerid] > 0) return SendClientMessage(playerid, COLOR_RED,"You already belong to an organization!");
if (Requesting[playerid] > 0) return SendClientMessage(playerid, COLOR_RED,"You are already requesting to join an organization!");
new ID;
if (sscanf(params, "d", ID)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /request [org id]");
if (ID < 1 || ID > OrgsCount) return SendClientMessage(playerid,COLOR_RED,"Invalid organization ID! Type /orglist for a complete list");
if (!IsLeaderOnline(ID)) return SendClientMessage(playerid,COLOR_RED,"The leader of this organization is currently offline!");
new string[120];
format(string,sizeof(string),"%s is requesting to join the %s", PlayerName(playerid), GetOrgName(ID));
SendClientMessageToAllEx(playerid, COLOR_GREY, string);
format(string,sizeof(string),"Your request to %s has been sent", GetOrgName(ID));
SendClientMessage(playerid, COLOR_YELLOW, string);
Requesting[playerid] = ID;
return 1;
}
CMD:decline(playerid, params[])
{
#pragma unused params
if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization");
new ID;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /decline [playerid]");
if (!IsPlayerConnected(ID) || ID == playerid) return 1;
new org = PlayerOrg[playerid];
if (Requesting[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player is not requesting to join your organization!");
new string[120];
format(string,sizeof(string),"Your request to %s has been declined by %s", GetOrgName(org), PlayerName(playerid));
SendClientMessage(ID, COLOR_GREY, string);
format(string,sizeof(string),"You have successfully declined %s's request", PlayerName(ID));
SendClientMessage(playerid, COLOR_YELLOW, string);
Requesting[ID] = 0;
return 1;
}
CMD:orglist(playerid, params[])
{
#pragma unused params
new string[90];
if (OrgsCount == 0) return SendClientMessage(playerid, COLOR_RED,"Sorry, there are no organizations created at the moment!");
SendClientMessage(playerid, COLOR_WHITE, "Current organizations:");
for (new i=1;i<OrgsCount+1;i++)
{
format(string,sizeof(string),"ID: %d || Name: %s || Leader: %s", i, GetOrgName(i), Organization[i][Leader]);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
CMD:members(playerid, params[])
{
#pragma unused params
if (!IsLeader(playerid)) return SendClientMessage(playerid, COLOR_RED,"You're not the leader of an organization");
new string[60];
new count = 0;
SendClientMessage(playerid, COLOR_YELLOW,"Employees online");
for (new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
if (PlayerOrg[i] == PlayerOrg[playerid] && i != playerid)
{
format(string,sizeof(string),"%s - %s", PlayerName(i), PlayerRank[i]);
SendClientMessage(playerid, COLOR_WHITE, string);
count++;
}
}
}
if (count == 0)
{
SendClientMessage(playerid, COLOR_YELLOW,"None of your employees are online");
}
else
{
format(string,sizeof(string),"%d member(s) online", count);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
CMD:myorg(playerid, params[])
{
#pragma unused params
if (PlayerOrg[playerid] == 0) return SendClientMessage(playerid, COLOR_RED,"You are not a member2of an organization");
new string[140];
format(string,sizeof(string),"{5CB3FF}Organization: {FFFFFF}%s\n{5CB3FF}Leader: {FFFFFF}%s", GetOrgName(PlayerOrg[playerid]), Organization[PlayerOrg[playerid]][Leader]);
ShowPlayerDialog(playerid, 757, DIALOG_STYLE_MSGBOX, "My organization", string, "Ok", "");
return 1;
}
CMD:resigns(playerid, params[])
{
new string[120];
format(string,sizeof(string),"You have resigned from %s", Organization[PlayerOrg[playerid]][Name]);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string,sizeof(string),"**%s has resigned from %s", PlayerName(playerid), Organization[PlayerOrg[playerid]][Name]);
SendClientMessageToAllEx(playerid, COLOR_GREY, string);
if (IsLeader(playerid))
{
new none[24];
format(none,sizeof(none),"None");
Organization[PlayerOrg[playerid]][Leader] = none;
}
ResetPlayerOrg(playerid);
SavePlayerOrgInfo(playerid);
return 1;
}
CMD:robbank(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid,0,0,0,0))
{
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 1)
{
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid,COLOR_RED,"Keep doing this and get money till the cops comes");
if(PlayerOrg[playerid] == 2)
{
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid,COLOR_RED,"Keep doing this and get money till the cops comes");
if(PlayerOrg[playerid] == 3)
{
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid,COLOR_RED,"Keep doing this and get money till the cops comes");
}
}
}
}
}
return 1;
}
CMD:tie(playerid, params[])
{
new id;
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 1)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, 0);
SendClientMessage(playerid,COLOR_RED,"You tied the player");
}
if(PlayerOrg[playerid] == 2)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, 0);
SendClientMessage(playerid,COLOR_RED,"You tied the player");
if(PlayerOrg[playerid] == 3)
{
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid,COLOR_RED,"Keep doing this and get money till the cops comes");
}
}
}
}
}
}
}
return 1;
}
CMD:untie(playerid, params[])
{
new id;
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 1)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, 1);
SendClientMessage(playerid,COLOR_RED,"You untied the player");
}
if(PlayerOrg[playerid] == 2)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, 1);
SendClientMessage(playerid,COLOR_RED,"You untied the player");
if(PlayerOrg[playerid] == 3)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
TogglePlayerControllable(id, 1);
SendClientMessage(playerid,COLOR_RED,"You untied the player");
}
}
}
}
}
}
}
}
}
return 1;
}
CMD:rob(playerid, params[])
{
new id;
if(!IsPlayerInRangeOfPoint(id,8.0,playerid,playerid,playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not near the person");
{
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 1)
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
if(GetPlayerMoney(playerid,1000))
{
GivePlayerMoney(playerid,1000);
GivePlayerMoney(id,-1000);
SendClientMessage(id,COLOR_RED,"The player has robbed you");
}
if(PlayerOrg[playerid] == 2)
{
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
if(GetPlayerMoney(playerid,1000))
{
GivePlayerMoney(playerid,1000);
GivePlayerMoney(id,-1000);
SendClientMessage(id,COLOR_RED, "The player has robbed you");
}
if(PlayerOrg[playerid] == 3)
{
{
if(strlen(params))
{
if(IsPlayerConnected(id))
{
if(GetPlayerMoney(playerid,1000))
{
GivePlayerMoney(playerid,1000);
GivePlayerMoney(id,-1000);
SendClientMessage(id,COLOR_RED, "The player has robbed you");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return 1;
}
CMD:givnucash(playerid, params[])
{
GivePlayerMoney(playerid,25000);
return 1;
}
CMD:gskin(playerid, params[])
{
if (PlayerOrg[playerid] == 1)
SetPlayerColor(playerid, COLOR_GROVE);
SetPlayerSkin(playerid, 106);
GivePlayerWeapon(playerid, 5,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 28, 200);
return 1;
}
CMD:bskin(playerid, params[])
{
if (PlayerOrg[playerid] == 2)
SetPlayerColor(playerid, COLOR_BALLAS);
SetPlayerSkin(playerid, 102);
GivePlayerWeapon(playerid, 5,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 32, 200);
return 1;
}
CMD:askin(playerid, params[])
{
if (PlayerOrg[playerid] == 3)
SetPlayerColor(playerid, COLOR_AZTECAS);
SetPlayerSkin(playerid, 116);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 28, 200);
return 1;
}
CMD:sskin(playerid, params[])
{
if (PlayerOrg[playerid] == 4)
SetPlayerColor(playerid, COLOR_SAPD);
SetPlayerSkin(playerid, 280);
GivePlayerWeapon(playerid, 3,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 16, 50);
return 1;
}
CMD:saafskin(playerid, params[])
{
if (PlayerOrg[playerid] == 5)
SetPlayerColor(playerid, COLOR_SAAF);
SetPlayerSkin(playerid, 287);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 24,200);
GivePlayerWeapon(playerid, 31, 200);
return 1;
}
CMD:sahskin(playerid, params[])
{
if (PlayerOrg[playerid] == 6)
SetPlayerColor(playerid, COLOR_SAH);
SetPlayerSkin(playerid, 274);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 17, 5);
return 1;
}
CMD:oskin(playerid, params[])
{
if(PlayerOrg[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"You are not in any organization, so stop using this command");
{
if (!IsPlayerInRangeOfPoint(playerid, 3.0,2459.3740,-1690.8842,13.5464)) return SendClientMessage(playerid,COLOR_RED,"You are not at the GSF Headquater");
{
if (PlayerOrg[playerid] == 1)
{
SetPlayerColor(playerid, Green1);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 107);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid,106);
GivePlayerWeapon(playerid, 5,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 28, 200);
}
if (!IsPlayerInRangeOfPoint(playerid, 3.0,1905.9891,-1113.5447,26.6641)) return SendClientMessage(playerid,COLOR_RED,"You are not at the Ballas Headquater");
{
if (PlayerOrg[playerid] == 2)
{
SetPlayerColor(playerid, COLOR_PURPLE);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 102);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid,103);
GivePlayerWeapon(playerid, 5,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 32, 200);
}
if (!IsPlayerInRangeOfPoint(playerid, 3.0,1882.8102,-2016.0778,13.5469)) return SendClientMessage(playerid,COLOR_RED,"You are not at the Los Aztecas Headquater");
{
if (PlayerOrg[playerid] == 3)
{
SetPlayerColor(playerid, blue1);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 116);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid, 115);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 28, 200);
}
if (!IsPlayerInRangeOfPoint(playerid, 3.0,1553.2577,-1675.4991,16.1953)) return SendClientMessage(playerid,COLOR_RED,"You are not at the SAPD Headquater");
{
if (PlayerOrg[playerid] == 4)
{
SetPlayerColor(playerid, COLOR_BLUE);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 280);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid, 281);
GivePlayerWeapon(playerid, 3,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 16, 50);
}
if (!IsPlayerInRangeOfPoint(playerid, 3.0,213.4593,1869.0469,13.1406)) return SendClientMessage(playerid,COLOR_RED,"You are not at the SAAF Headquater");
{
if (PlayerOrg[playerid] == 5)
{
SetPlayerColor(playerid, Green2);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 287);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid,286);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 24,200);
GivePlayerWeapon(playerid, 31, 200);
}
if (!IsPlayerInRangeOfPoint(playerid, 3.0, -2650.2827,634.9139,14.4531)) return SendClientMessage(playerid,COLOR_RED,"You are not at the SAH Headquater");
{
if (PlayerOrg[playerid] == 6)
{
SetPlayerColor(playerid, red);
if(IsLeader(playerid))
{
SetPlayerSkin(playerid, 274);
if(!IsLeader(playerid))
{
SetPlayerSkin(playerid, 275);
GivePlayerWeapon(playerid, 4,1);
GivePlayerWeapon(playerid, 22,200);
GivePlayerWeapon(playerid, 17, 5);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return 1;
}
CMD:orghelp(playerid, params[])
{
#pragma unused params
SendClientMessage(playerid, COLOR_YELLOW, "Dynamic Organizations by Jakku");
SendClientMessage(playerid, COLOR_WHITE, "/orglist || /myorg || /request || /resign || /org || /oc");
if (IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE,"RCON- Admin commands: /setleader");
if (IsLeader(playerid)) SendClientMessage(playerid, COLOR_WHITE,"Leader commands: /setmember || /kickmember || /setrank || /members || /ovres || /decline");
return 1;
}
stock GetOrgID(name[])
{
if (strlen(name) <= 0) return 0;
for (new i=1;i<OrgsCount+1;i++)
{
if (strcmp(name,Organization[i][Name],true) == 0) return i;
}
return 0;
}
stock CreateOrgVehicle(org[32], model, Float:x,Float:y,Float:z,Float:rot, clr1,clr2)
{
if (!DoesOrgExist(org)) return printf("You are attempting to create org. vehicles for an org. which does not exist!");
new orgid = GetOrgID(org);
new freeslot = Organization[orgid][VehiclesCreated];
if (freeslot >= MAX_ORG_VEHICLES) return printf("Error: %s cannot handle more vehicles! Aborted", org);
Organization[orgid][Vehicles][freeslot] = CreateVehicle(model, x,y,z,rot,clr1,clr2,900);
printf("Added org. vehicle: %d to slot %d for %s",model,freeslot+1, org);
Organization[orgid][VehiclesCreated]++;
return 1;
}
stock IsLeaderOnline(org)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (PlayerOrg[i] == org && PlayerLeader[i] == 1) return true;
}
}
return false;
}
stock IsLeader(playerid)
{
if (PlayerOrg[playerid] != 0 && PlayerLeader[playerid] == 1) return 1;
return 0;
}
stock IsVehicleConnected(vehicleid)
{
new Float:x1,Float:y1,Float:z1;
GetVehiclePos(vehicleid,x1,y1,z1);
if(x1==0.0 && y1==0.0 && z1==0.0)
{
return 0;
}
return 1;
}
stock DoesOrgExist(orgname[32])
{
for (new i=1;i<OrgsCount+1;i++)
{
if (strcmp(Organization[i][Name], orgname, true) == 0) return 1;
}
return 0;
}
stock CreateOrganizationZone(orgname[32], Float:minx,Float:miny,Float:maxx,Float:maxy, color)
{
if (!DoesOrgExist(orgname)) return printf("Error: You are attempting to create a gangzone for '%s' which does not exist", orgname);
new orgid = GetOrgID(orgname);
Organization[orgid][ZonesCreated]++;
if (Organization[orgid][ZonesCreated] >= MAX_ZONES_PER_ORG) return printf("Error: You are attempting to create more than %d zones for %s", MAX_ZONES_PER_ORG, orgname);
new id = Organization[orgid][ZonesCreated];
Organization[orgid][ZoneMinX][id] = minx;
Organization[orgid][ZoneMinY][id] = miny;
Organization[orgid][ZoneMaxX][id] = maxx;
Organization[orgid][ZoneMaxY][id] = maxy;
Organization[orgid][ZoneColor][id] = hexToDec(color);
Organization[orgid][Zones][id] = GangZoneCreate(minx, miny, maxx, maxy);
ZoneCount++;
return ZoneCount;
}
stock hexToDec(hex) { new out[11]; format(out, 11, "%i", hex); return strval(out); }
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
new Float:AX, Float:AY, Float:AZ;
GetPlayerPos(playerid, AX, AY, AZ);
if (AX > MinX && AX < MaxX && AY > MinY && AY < MaxY) return true;
else return false;
}
stock IsPlayerInOrgZone(playerid, orgname[32])
{
new orgid = GetOrgID(orgname);
if (DoesOrgExist(orgname))
{
for (new i=1;i<ZoneCount+1;i++)
{
if (Organization[orgid][ZoneMinX][i] != 0.0)
{
if (IsPlayerInArea(playerid, Organization[orgid][ZoneMinX][i],Organization[orgid][ZoneMinY][i],Organization[orgid][ZoneMaxX][i],Organization[orgid][ZoneMaxY][i]))
{
return 1;
}
}
}
}
return 0;
}
stock SendClientMessageToOrg(orgname[32], clr, msg[])
{
if (!DoesOrgExist(orgname)) return 0;
for (new a=0;a<MAX_PLAYERS;a++)
{
if (IsPlayerConnected(a))
{
if (PlayerOrg[a] == GetOrgID(orgname))
{
SendClientMessage(a, clr, msg);
}
}
}
return 1;
}
forward Jail(playerid);
public Jail(playerid)
{
SetPlayerPos(playerid,0,0,0);
return 1;
}
// CMDS
dcmd_cuff(playerid,params[])
{
new id;
if(!IsPlayerInRangeOfPoint(id,8.0,playerid,playerid,playerid)) return SendClientMessage(playerid,COLOR_RED,"The player is not near you");
{
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 4)
if(PlayerOrg[playerid] == 5)
if(strlen(params))
{
if(IsPlayerConnected(id))
{
SetPlayerAttachedObject(id, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
SetPlayerSpecialAction(id,SPECIAL_ACTION_CUFFED);
SetCameraBehindPlayer(id);
GameTextForPlayer(id,"~r~Cuffed!!",1000,6);
GameTextForPlayer(playerid,"~r~Cuffed them",1000,6);
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"[Server]: Player not found, or invalid id.");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"[Server-Usage]: (/cuff [playerid])");
}
}
return 1;
}
dcmd_jail(playerid, params[])
{
new id;
if(!IsPlayerInRangeOfPoint(playerid,8.0,0,0,0)) return SendClientMessage(playerid,COLOR_RED,"You cant jail the player at this location");
if(!IsPlayerInRangeOfPoint(id,8.0,0,0,0)) return SendClientMessage(playerid,COLOR_RED,"The player you want to jail is not at the same position at which you are");
{
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 4)
if(PlayerOrg[playerid] == 5)
if(strlen(params))
{
if(IsPlayerConnected(id))
{
SetPlayerPos(playerid,0,0,0);
SendClientMessage(playerid,COLOR_RED,"You have jailed the criminal");
}
}
}
}
return 1;
}
//
dcmd_uncuff(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(id,8.0,playerid,playerid,playerid)) return SendClientMessage(playerid,COLOR_RED,"The player is not near you");
{
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 4)
if(PlayerOrg[playerid] == 5)
if(strlen(params))
{
if(IsPlayerConnected(id))
{
RemovePlayerAttachedObject(id,0);
SetPlayerSpecialAction(id,SPECIAL_ACTION_NONE);
SetCameraBehindPlayer(id);
GameTextForPlayer(id,"~r~Cuffed!!",1000,6);
GameTextForPlayer(playerid,"~r~Cuffed them",1000,6);
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"[Server]: Player not found, or invalid id.");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"[Server-Usage]: (/cuff [playerid])");
}
}
}
}
return 1;
}
// stocks
stock ReturnPlayerName(ID)
{
new name[25];
GetPlayerName(ID, name, 25);
return name;
}
stock Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x3,y3,z3);
return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}
forward stuntimer(taze);
forward tazetimer(i);
dcmd_taze(playerid, params[])
{
new taze = strval(params);
if(PlayerOrg[playerid] == 0)
{
if(PlayerOrg[playerid] == 4)
if(PlayerOrg[playerid] == 5)
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /taze [ID]");
}
else
{
if(IsPlayerConnected(taze))
{
if(GetDistanceBetweenPlayers(playerid, taze) <= 6)
{
if(tazetime[playerid] == 0)
{
new tehtaze = random(5);
if(tehtaze == 1 || tehtaze == 2 || tehtaze == 3 || tehtaze == 4)
{
new string[256], Float:thlth;
format(string, sizeof(string), "%s (%i) has tazed you.",ReturnPlayerName(playerid), playerid);
SendClientMessage(taze, COLOR_MSG, string);
format(string, sizeof(string), "You have tazed %s (%i).",ReturnPlayerName(taze), taze);
SendClientMessage(playerid, COLOR_MSG, string);
GetPlayerHealth(taze, thlth);
new Float:tehtaze3 = thlth-15-random(30);
SetPlayerHealth(taze, tehtaze3);
if(thlth < tehtaze3)
{
format(string, sizeof(string), "%s (%i) has been tazed to death", ReturnPlayerName(taze), taze);
SendClientMessageToAll(COLOR_KILLED, string);
}
else
{
SendClientMessage(taze, COLOR_MSG, "You are stunned for a while.");
TogglePlayerControllable(taze, 0);
stunned[taze] = 1;
tazetime[playerid] = 1;
SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", taze);
}
}
else
{
new string[256], Float:phlth;
format(string, sizeof(string), "%s (%i) has accidentally held the tazer the wrong way and tazed himself",ReturnPlayerName(playerid), playerid);
SendClientMessage(taze, COLOR_MSG, string);
SendClientMessage(playerid, COLOR_MSG, "You accidentally held the tazer the wrong way and tazed yourself");
GetPlayerHealth(playerid, phlth);
new Float:tehtaze2 = phlth-25-random(30);
SetPlayerHealth(playerid, tehtaze2);
if(phlth < tehtaze2)
{
format(string, sizeof(string), "%s (%i) has been tazed to death",ReturnPlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_KILLED, string);
}
else
{
SendClientMessage(playerid, COLOR_MSG, "You are stunned for a while.");
TogglePlayerControllable(playerid, 0);
stunned[playerid] = 1;
SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", playerid);
SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
tazetime[playerid] = 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_MSG, "Please wait before tazing someone again!");
}
}
else
{
new string[256];
format(string, sizeof(string), "%s (%i) is not close enough to taze!", ReturnPlayerName(taze), taze);
}
}
else
{
SendClientMessage(playerid, COLOR_MSG, "That player is not connected!");
}
}
}
return 1;
}
// stocks
public stuntimer(taze)
{
stunned[taze] = 0;
TogglePlayerControllable(taze, 1);
SendClientMessage(taze, COLOR_MSG, "You have recovered from the tazer-shock");
}
public tazetimer(i)
{
tazetime[i] = 0;
}
4 Errors are C:\DOCUME~1\MOSTWA~1\MYDOCU~1\DOWNLO~1\SAMP03~1\FI LTER~1\lolyman.pwn(471) : error 017: undefined symbol "dcmd_uncuff"
C:\DOCUME~1\MOSTWA~1\MYDOCU~1\DOWNLO~1\SAMP03~1\FI LTER~1\lolyman.pwn(472) : error 017: undefined symbol "dcmd_jail"
Can you fix this 4 errors, simply copy this pwn. and fix it and then give me it.
and in this pwn. Can you create only 1 level with timer, others i will create myself
1 level timer: 1 hour, and when someone reaches 1 level then he gets a msg and he gets moneys 500.
I already added it, still same errors, copy and paste it in your pwn. then fix it then send me it
You are using dcmd codes when you are using zcmd. You need to put this
and also you need to download dcmd include if you don't have the include in your pawn/include folder
Try this, it MIGHT help.