Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <dini>
- enum dData
- {
- Gangid,
- Gangrank
- }
- new PlayerInfo[MAX_PLAYERS][dData];
- #define PlayerFile "playergang/%s.ini"
- #define MAX_GANGS 3
- enum gData
- {
- Ganggp
- }
- new GangInfo[MAX_PLAYERS][gData];
- #define GangsFile "Gangsgp.ini"
- #define COLOR_RED 0xFF0000FF
- //gangzone
- new Zone1;
- new capture1 = 1;
- new capture1start = 0;
- new Zone2;
- new capture2 = 2;
- new capture2start = 0;
- new Zone3;
- new capture3 = 3;
- new capture3start = 0;
- public OnFilterScriptInit()
- {
- new file2[256], id;
- format(file2,sizeof(file2),GangsFile);
- GangInfo[id][Ganggp] = dini_Int(file2, "Ganggp");
- //GANGS CAPTURE PICKUP
- CreatePickup(1314 , 1, 1493.9996, 751.0131, 29.6638, -1);//GANG1
- CreatePickup(1314 , 1, 1089.1531, 1073.2957, 11.3150, -1);//GANG2
- CreatePickup(1314 , 1, 983.0714, 1733.2091, 9.3417, -1);//GANG3
- //GANGS CAPTURE ZONES
- Zone1 = GangZoneCreate(1310.488, 645.488, 1560.399, 823.4191);//zone GANG 1
- Zone2 = GangZoneCreate(923.9085, 951.0652, 1181.628, 1198.621);//zone GANG 2
- Zone3 = GangZoneCreate(857.5261, 1616.373, 994.1957, 1863.929);//zone GANG 3
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new file[256], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(file,sizeof(file),PlayerFile,name);
- if(!dini_Exists(file) )
- {
- dini_Create(file);
- dini_Set(file,"Name",name);
- dini_IntSet(file,"Gangid",0);
- PlayerInfo[playerid][Gangid] = 0;
- PlayerInfo[playerid][Gangrank] = 0;
- }
- else
- {
- PlayerInfo[playerid][Gangid] = dini_Int(file,"Gangid");
- PlayerInfo[playerid][Gangrank] = dini_Int(file,"Gangrank");
- new file2[256];
- format(file2,sizeof(file2),GangsFile);
- dini_IntSet(file2,"Ganggp",GangInfo[playerid][Ganggp]);
- GangInfo[playerid][Ganggp] = dini_Int(file2, "Ganggp");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[256], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(file,sizeof(file),PlayerFile,name);
- if(dini_Exists(file) )
- {
- dini_IntSet(file,"Gangid",PlayerInfo[playerid][Gangid]);
- dini_IntSet(file,"Gangrank",PlayerInfo[playerid][Gangrank]);
- }
- new file2[256];
- format(file2,sizeof(file2),GangsFile);
- dini_IntSet(file2,"Ganggp",GangInfo[playerid][Ganggp]);
- return 1;
- }
- CMD:setgangid(playerid,params[])
- {
- new id, level;
- if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
- if(sscanf(params,"ud",id,level) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /setgangid [id][gangid]");
- if(level > MAX_GANGS) return SendClientMessage(playerid,COLOR_RED,"Invalid Level");
- if(!IsPlayerConnected(id) ) return SendClientMessage(playerid,COLOR_RED,"Player is not connected");
- else
- {
- PlayerInfo[id][Gangid] = level;
- SpawnPlayer(id);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(PlayerInfo[playerid][Gangid] == 0)
- {
- SetPlayerPos(playerid,1509.4786,-1707.0342,14.0469); // ls
- }
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- SetPlayerPos(playerid, 1489.5876, 691.9392, 11.9275);
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- SetPlayerPos(playerid, 1046.1687, 1014.2678, 11.7839);
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- SetPlayerPos(playerid, 938.0714, 1733.2091, 9.3417);
- }
- //GANGZONES
- if(capture1 == 1) GangZoneShowForAll(Zone1,0xFF000096);
- if(capture1 == 2) GangZoneShowForAll(Zone1,0xFFFFFF96);
- if(capture1 == 3) GangZoneShowForAll(Zone1,0xFFFF009A);
- //
- if(capture2 == 1) GangZoneShowForAll(Zone2,0xFF000096);//0xFF000096 ROSSO
- if(capture2 == 2) GangZoneShowForAll(Zone2,0xFFFFFF96);//0xFFFFFF96 BIANCO
- if(capture2 == 3) GangZoneShowForAll(Zone2,0xFFFF009A);//0xFFFF009A GIALLO
- //
- if(capture3 == 1) GangZoneShowForAll(Zone3,0xFF000096);
- if(capture3 == 2) GangZoneShowForAll(Zone3,0xFFFFFF96);
- if(capture3 == 3) GangZoneShowForAll(Zone3,0xFFFF009A);
- return 1;
- }
- CMD:capture(playerid, params[])
- {
- ///////////////////////////////capture 1
- if(PlayerInfo[playerid][Gangid] == 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You must be in a gang for use this command.");
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
- {
- if(capture1start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- if(capture1 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone1,0xFF000096);
- capture1start = 1;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- if(capture1 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone1,0xFFFFFF96);
- capture1start = 2;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- if(capture1 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone1,0xFFFF009A);
- capture1start = 3;
- }
- }
- ///////////////////////////////capture 2
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
- {
- if(capture2start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- if(capture2 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone2,0xFF000096);
- capture2start = 1;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- if(capture2 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone2,0xFFFFFF96);
- capture2start = 2;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- if(capture2 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone2,0xFFFF009A);
- capture2start = 3;
- }
- }
- //////////////////////capture 3
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
- {
- if(capture3start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- if(capture3 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone3,0xFF000096);
- capture3start = 1;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- if(capture3 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone3,0xFFFFFF96);
- capture3start = 2;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- if(capture3 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
- SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
- GangZoneFlashForAll(Zone3,0xFFFF009A);
- capture3start = 3;
- }
- }
- return 1;
- }
- forward EndAntiSpawnKill(playerid);
- public EndAntiSpawnKill(playerid)
- { ///////////////////////////////capture 1
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
- { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- GangZoneStopFlashForAll(Zone1);
- GangZoneShowForAll(Zone1,0xFF000096);
- capture1 = 1;
- capture1start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- GangZoneStopFlashForAll(Zone1);
- GangZoneShowForAll(Zone1,0xFFFFFF96);
- capture1 = 2;
- capture1start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- GangZoneStopFlashForAll(Zone1);
- GangZoneShowForAll(Zone1,0xFFFF009A);
- capture1 = 3;
- capture1start =0;
- }
- }
- else
- if(capture1start >= 1)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
- {
- SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- GangZoneStopFlashForAll(Zone1);
- if(capture1start == 1 && capture1 == 1) return capture1 = 1;
- if(capture1start == 1 && capture1 == 2) return capture1 = 2;
- if(capture1start == 1 && capture1 == 3) return capture1 = 3;
- if(capture1start == 2 && capture1 == 1) return capture1 = 1;
- if(capture1start == 2 && capture1 == 2) return capture1 = 2;
- if(capture1start == 2 && capture1 == 3) return capture1 = 3;
- if(capture1start == 3 && capture1 == 1) return capture1 = 1;
- if(capture1start == 3 && capture1 == 2) return capture1 = 2;
- if(capture1start == 3 && capture1 == 3) return capture1 = 3;
- }
- }
- //}
- ///////////////////////////////capture 2
- //if(capture2 >= 4)
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
- { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- GangZoneStopFlashForAll(Zone2);
- GangZoneShowForAll(Zone2,0xFF000096);
- capture2 = 1;
- capture2start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- GangZoneStopFlashForAll(Zone2);
- GangZoneShowForAll(Zone2,0xFFFFFF96);
- capture2 = 2;
- capture2start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- GangZoneStopFlashForAll(Zone2);
- GangZoneShowForAll(Zone2,0xFFFF009A);
- capture2 = 3;
- capture2start =0;
- }
- }
- else
- if(capture2start >= 1)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
- {
- SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- GangZoneStopFlashForAll(Zone2);
- capture2start = 0;
- if(capture2start == 1 && capture2 == 1) return capture2 = 1;
- if(capture2start == 1 && capture2 == 2) return capture2 = 2;
- if(capture2start == 1 && capture2 == 3) return capture2 = 3;
- if(capture2start == 2 && capture2 == 1) return capture2 = 1;
- if(capture2start == 2 && capture2 == 2) return capture2 = 2;
- if(capture2start == 2 && capture2 == 3) return capture2 = 3;
- if(capture2start == 3 && capture2 == 1) return capture2 = 1;
- if(capture2start == 3 && capture2 == 2) return capture2 = 2;
- if(capture2start == 3 && capture2 == 3) return capture2 = 3;
- }
- }
- ///////////////////////////////////capture 3
- if (IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
- { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- if(PlayerInfo[playerid][Gangid] == 1)
- {
- GangZoneStopFlashForAll(Zone3);
- GangZoneShowForAll(Zone3,0xFF000096);
- capture3 = 1;
- capture3start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 2)
- {
- GangZoneStopFlashForAll(Zone3);
- GangZoneShowForAll(Zone3,0xFFFFFF96);
- capture3 = 2;
- capture3start =0;
- }
- if(PlayerInfo[playerid][Gangid] == 3)
- {
- GangZoneStopFlashForAll(Zone3);
- GangZoneShowForAll(Zone3,0xFFFF009A);
- capture3 = 3;
- capture3start =0;
- }
- }
- else
- {
- if(capture3start >= 4)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
- {
- SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
- GangZoneStopFlashForAll(Zone3);
- if(capture3start == 1 && capture3 == 1) return capture3 = 1;
- if(capture3start == 1 && capture3 == 2) return capture3 = 2;
- if(capture3start == 1 && capture3 == 3) return capture3 = 3;
- if(capture3start == 2 && capture3 == 1) return capture3 = 1;
- if(capture3start == 2 && capture3 == 2) return capture3 = 2;
- if(capture3start == 2 && capture3 == 3) return capture3 = 3;
- if(capture3start == 3 && capture3 == 1) return capture3 = 1;
- if(capture3start == 3 && capture3 == 2) return capture3 = 2;
- if(capture3start == 3 && capture3 == 3) return capture3 = 3;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement