Započeo pokerface
•8. Mar. 2019.• ZaključanoUsporedivanje Manjih/Vecih Gangzona.
1,106
pregleda
15
postova
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
8. Mar. 2019.
Problem(error/warning): Nije problem, nego vise pitanje. Ne znam na koji nacin da uradim neke od provjera koja ce odvojiti manje gangzone po koordinatama od onih vecih ako je ikako moguce.
Dio skripte:
Ovako radim CP I gangzone.
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]vaš odgovor[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): link slike
Dio skripte:
Ovako radim CP I gangzone.
new const ZoneInfo[] =
{
{"LV Airbase", {1231, 1203, 1628, 1867}, {1312.2656,1617.3121,10.8203}, 0}, //0
{"Submarine Port", {-10, 2912, 544, 3255}, {263.7045,3031.9456,11.2221}, 1}, //1
{"Haunted Base", {-605, 2537, -493, 2654}, {-564.8030,2569.7290,53.5156}, 2}, //2
{"Chemical Refinery", {103, 1331, 295, 1487}, {213.5669,1350.0870,10.5859}, 3}, //3
{"Desert Zone", {-376, 1801, -241, 1916}, {-305.4872,1838.8951,42.2891}, 4}, //4
{"Construction Site", {-140, 1869, -91, 1931}, {-120.6943,1903.2755,15.3800}, 0}, //5
{"Sniperhut", {433, 2272, 507, 2346}, {481.8103,2308.1157,38.8940}, 1}, //6
{"Ranch Shack", {675, 1951, 732, 2004}, {703.2129,1963.0461,5.5391}, 2}, //7
{"Ammunation", {757, 1847, 806, 1909}, {782.3793,1871.3038,4.8533}, 3}, //8
{"Desert Camp", {773, 1600, 826, 1734}, {799.0922,1686.9808,5.2813}, 4}, //9
{"Octane Springs", {530, 1192, 695, 1272}, {609.1064,1208.5597,11.7188}, 0}, //10
{"Cluckin' Bell", {147, 1155, 204, 1199}, {171.5608,1174.5854,14.7578}, 1}, //11
{"Ammo Depot", {1397, 2320, 1558, 2383}, {1444.2500,2360.1401,10.8203}, 2}, //12
{"Factory", {916, 2046, 999, 2184}, {972.2277,2071.9954,10.8203}, 3}, //13
{"Cargo", {1532, 525, 1710, 622}, {1672.1604,559.6873,7.1328}, 4}, //14
{"Whitewood Church", {915, 1861, 969, 1912}, {929.4318,1891.6390,12.8379}, 0}, //15
{"Battleship", {-869, 2171, -573, 2230}, {-645.3881,2203.3589,51.2932}, 1}, //16
{"Tierra Bridge", {-1138, 2661, -867, 2741}, {-906.7224,2698.2632,41.9279}, 2}, //17
{"Nuke Station", {-409, 1497, -232, 1647}, {-347.7741,1580.8589,76.3168}, 3}, //18
{"F.C. Gas", {-343, 1007, -285, 1066}, {-331.6724,1040.6094,19.7422}, 4}, //19
{"Weapon Depot", {-354, 797, -296, 861}, {-315.2905,829.8641,14.2422}, 0}, //20
{"Blackfield", {1018, 1204, 1178, 1364}, {1166.5272,1348.1775,10.9219}, 1}, //21
{"Recharge Point", {-58, 2309, 5, 2372}, {-49.5880,2353.1509,24.4427}, 2}, //22
{"Xoomer", {539, 1619, 698, 1759}, {636.9102,1687.9380,6.9922}, 3}, //23
{"Headquarters", {3076,2057,3158,2106}, {3092.2126,2094.6006,21.6919}, 4}, //24
{"Petrol Refinery", {-77, 1461, 84, 1591}, {-38.7557,1535.7911,12.8000}, 0}, //25
{"Hospital", {1018, 1721, 1117, 1803}, {1054.4314,1758.7367,10.9157}, 1}, //26
{"Desert Airport", {-81, 2378, 526, 2663}, {426.4098,2500.9263,17.6634}, 2}, //27
{"Quarry", {384, 715, 837, 1038}, {590.0967,869.7262,-42.4973}, 3}, //28
{"Military Port", {214, 348, 521, 618}, {295.1580,406.9670,6.4504}, 1}, //29
{"North Tower", {662, 2760, 876, 2901}, {712.8585,2780.5520,96.4743}, 2}, //30
{"Command Center", {-1278, 2113, -1099, 2210}, {-1230.3333,2184.3452,100.9999}, 4}, //31
{"Outpost", {-1540, 1927, -1420, 2075}, {-1494.8730,1972.1803,48.4219}, 2}, //32
{"Bunker", {-1410, 2019, -1350, 2075}, {-1381.5803,2044.0314,52.5568}, 0}, //33
{"Bank", {36, 1652, 209, 1746}, {147.6750,1712.1902,17.9891}, 1} //34
};
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]vaš odgovor[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): link slike
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
9. Mar. 2019.
Ako ti ovo gore nije jasno onda nezz. Pa lijepo, svaka od ovih GangZona sto vidis na mini-mapi je drugacija, jedne su manje a druge veće, I ja sad hocu da ih razdvojim. Tako da bi one manje zone trebalo 15 sekundi da zauzmes a one veće 30.
@Ino42O ili bilo tko, sorry za tag.
A ako nije moguce, na koji nacin da onda dodam valutu npr 0/1 na zonu koju hocu da ima 15 sekundi zauzimanja ili ne. Primjer:
Ovo mi je array.
Igrac ulazi u CP.
Timer poziva ovu funkciju, u toj funkciji hocu da se provjerava ako zona ima 0/1 kako sam gore naveo da zauzimanje bude 15 sekundi, a ako ima 0 da bude normalno 30.
A valjda ste razumijeli sto hocu 😄 😄
@Ino42O ili bilo tko, sorry za tag.
A ako nije moguce, na koji nacin da onda dodam valutu npr 0/1 na zonu koju hocu da ima 15 sekundi zauzimanja ili ne. Primjer:
{"LV Airbase", {1231, 1203, 1628, 1867}, {1312.2656,1617.3121,10.8203}, 0, 1}, 1 na kraju bi znacilo da ce trebati 15 sekundi {"SubPort",{1231, 1203, 1628, 1867}, {1312.2656,1617.3121,10.8203}, 0, 0}, 0 na kraju bi znacilo da ce trebati 30 sekundi, to jest standard 30 sekundi. Ovo mi je array.
enum E_CAPTURE_ZONE
{
E_CAPTURE_ZONE_NAME,
Float:E_CAPTURE_ZONE_GANGZONE_OFFSET,
Float:E_CAPTURE_ZONE_CP_OFFSET,
E_CAPTURE_ZONE_OWNER,
E_CAPTURE_ZONE_ATTACKER,
E_CAPTURE_ZONE_COUNTDOWN,
E_CAPTURE_ZONE_GANGZONE,
E_CAPTURE_ZONE_CP,
E_CAPTURE_ZONE_AREA,
E_CAPTURE_ZONE_TIMER,
E_CAPTURE_ZONE_PLAYERS_IN_ZONE,
Text3D:E_CAPTURE_ZONE_LABEL
};
GameModeInit. Znaci, ovdje imam timer od 1 sekunde a svaka zona treba 30 sekundi da je zauzmes.
for (new i; i < sizeof captureZone; i++)
{
captureZone = INVALID_PLAYER_ID;
captureZone = 0;
captureZone = GangZoneCreate(captureZone, captureZone, captureZone, captureZone);
captureZone = CreateDynamicCP(captureZone, captureZone, captureZone, 3.0);
captureZone = CreateDynamicRectangle(captureZone, captureZone, captureZone, captureZone);
captureZone = CreateDynamicMapIcon(captureZone, captureZone, captureZone, 19, -1, -1, -1, -1, 9999.0, MAPICON_LOCAL);
format(string, sizeof(string), ""COL_WHITE"%s"COL_YELLOW"(%i)", captureZone, i);
captureZone = CreateDynamic3DTextLabel(string, TEAM[ captureZone ], captureZone, captureZone, captureZone, 35.0, _, _, 0, 0);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
}Igrac ulazi u CP.
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for (new i; i < sizeof captureZone; i++)
{
if (checkpointid == captureZone)
{
if (IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_TOMATO, "* You cannot capture a zone in a vehicle.");
return 1;
}
if(AdminDuty == 1)
{
SendClientMessage(playerid, COLOR_TOMATO, "No way! You can't capture zone while on duty!");
return 1;
}
if(GetPlayerTeam(playerid) == captureZone)
{
SCM(playerid, COLOR_ORANGE_RED, "* This zone is controlled by your team.");
break;
}
if (captureZone == INVALID_PLAYER_ID)
{
if ((GetPlayerTeam(playerid) >= 0 && GetPlayerTeam(playerid) < sizeof TEAM) && TEAM[GetPlayerTeam(playerid)] && GetPlayerTeam(playerid) != captureZone)
{
captureZone = playerid;
captureZone = 1;
captureZone = 0;
KillTimer(captureZone);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
GangZoneFlashForAll(captureZone, ALPHA(TEAM[GetPlayerTeam(playerid)], 100));
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint to for "#CAPTURE_TIME" seconds to capture the zone.");
new string;
format(string, sizeof string, " "COL_WHITE"Someone is trying to capture "OLIVE_GREEN"%s "COL_WHITE"for team "DARK_RED"%s !", captureZone, TEAM[GetPlayerTeam(playerid)]);
SendClientMessageToAll(COLOR_DARK_RED, string);
}
else return 1;
}
else if (GetPlayerTeam(playerid) == GetPlayerTeam(captureZone))
{
captureZone++;
SCM(playerid, COLOR_GREEN, "* Stay in the checkpoint to assist your teammate in capturing the area.");
}
PlayerTextDrawShow(playerid, capturePlayerTextDraw);
PlayerTextDrawShow(playerid, capturePlayerPreview);
ShowPlayerProgressBar(playerid, capturePlayerBar);
return 1;
}
}
return 1;
}Timer poziva ovu funkciju, u toj funkciji hocu da se provjerava ako zona ima 0/1 kako sam gore naveo da zauzimanje bude 15 sekundi, a ako ima 0 da bude normalno 30.
{"LV Airbase", {1231, 1203, 1628, 1867}, {1312.2656,1617.3121,10.8203}, 0, 1}, 1 na kraju bi znacilo da ce trebati 15 sekundi {"SubPort",{1231, 1203, 1628, 1867}, {1312.2656,1617.3121,10.8203}, 0, 0}, 0 na kraju bi znacilo da ce trebati 30 sekundi, to jest standard 30 sekundi. forward OnCaptureZoneUpdate(zoneid);
public OnCaptureZoneUpdate(zoneid)
{
captureZone += captureZone;
new string;
format(string, sizeof string, "Capturing %i...", CAPTURE_TIME - captureZone);
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
if (IsPlayerInDynamicCP(i, captureZone) &&
!IsPlayerInAnyVehicle(i) &&
GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
PlayerTextDrawSetString(i, capturePlayerTextDraw, string);
SetPlayerProgressBarValue(i, capturePlayerBar, captureZone);
}
}
if (captureZone > CAPTURE_TIME)
{
GetPlayerName(captureZone, string, MAX_PLAYER_NAME);
format(string, sizeof string, "* Good job soldier. You assisted %s to capture "LIGHT_GREEN"%s. +$500", string, captureZone);
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
if (IsPlayerInDynamicCP(i, captureZone) &&
!IsPlayerInAnyVehicle(i) &&
GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
PlayerTextDrawHide(i, capturePlayerTextDraw);
PlayerTextDrawHide(i, capturePlayerPreview);
HidePlayerProgressBar(i, capturePlayerBar);
if (i != captureZone)
{
SendClientMessage(i, COLOR_GREEN, string);
GivePlayerCash(i, 500);
}
}
if(GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
format(string, sizeof(string), "** You recieved +2 score from the captured zone by your team.");
SCM(i, COLOR_LIGHTBLUE, string);
SetPlayerScore(i, PInfo += 2);
}
if(GetPlayerTeam(i) == captureZone)
{
format(string, sizeof(string), "** You recieved -2 score, your team lost the zone.");
SCM(i, COLOR_LIGHTBLUE, string);
SetPlayerScore(i, PInfo -= 2);
}
}
SetPlayerScore(captureZone, GetPlayerScore(captureZone) + 5);
GivePlayerCash(captureZone, 4500);
format(string, sizeof string, " You successfully captured "COL_ORANGE"%s. "COL_WHITE"+5 Score +$4500", captureZone);
SendClientMessage(captureZone, COLOR_GREEN, string);
PInfo[captureZone]++;
format(string, sizeof string, ""COL_ORANGE"(!) %s team have captured '%s' .", TEAM[GetPlayerTeam(captureZone)], captureZone);
SCMToAll(-1, string);
new text;
format(text, sizeof(text), ""COL_WHITE"%s"COL_YELLOW"(%i)", captureZone, zoneid);
UpdateDynamic3DTextLabelText(captureZone, TEAM[captureZone], text);
captureZone = GetPlayerTeam(captureZone);
captureZone = INVALID_PLAYER_ID;
KillTimer(captureZone);
GangZoneStopFlashForAll(captureZone);
GangZoneShowForAll(captureZone, ALPHA(TEAM[captureZone], 100));
}
return 1;
}A valjda ste razumijeli sto hocu 😄 😄
Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
40
Postovi:
4
Teme:
Pridružio se:Mar. 2016
9. Mar. 2019.
pa to je malo komplikovano, trebao bi od svake gangzone bukvalno odrediti pocetak i kraj ali kao kvadrat i morao bi to pretvoriti i tako za svaku i onda samo rasporedis po velicini realno, previse komplikovano jbg a i ne vidim potrebu sto bi to radio
Shot Caller
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
171
Postovi:
26
Teme:
Pridružio se:Okt. 2015
9. Mar. 2019.
Ako zone nisu dinamiÄne (da ih ingame kreiraÅ¡) nego si ih ti pravio u pawno najbolja solucija bi ti bila da uzmes igracevu poziciju (getplayerpos) i onda ifisplayerinrangeofpoint i onda tako praviÅ¡.
Npr ako je kod kordinata recimo manje zone stavis 15 sekundi tajmer a ako je kod kordinata druge zone staviš 30.
lp nadam se da sam pomogao :p
Edit - ako je dinamiÄno mogao bi da ubacis nesto kao ajmo reći vrste zona sto nije uopste tesko uraditi.
Ako je vrsta 1 (mala) onda stavis proveru dal je zona mala i stavis 15 sekundi a ako je zona velika (2) stavis 30.
Npr ako je kod kordinata recimo manje zone stavis 15 sekundi tajmer a ako je kod kordinata druge zone staviš 30.
lp nadam se da sam pomogao :p
Edit - ako je dinamiÄno mogao bi da ubacis nesto kao ajmo reći vrste zona sto nije uopste tesko uraditi.
Ako je vrsta 1 (mala) onda stavis proveru dal je zona mala i stavis 15 sekundi a ako je zona velika (2) stavis 30.
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
10. Mar. 2019.
Jack1337 wrote on March 9, 2019, 11:46 pm:
Edit - ako je dinamiÄno mogao bi da ubacis nesto kao ajmo reći vrste zona sto nije uopste tesko uraditi.
Ako je vrsta 1 (mala) onda stavis proveru dal je zona mala i stavis 15 sekundi a ako je zona velika (2) stavis 30.
Ako je vrsta 1 (mala) onda stavis proveru dal je zona mala i stavis 15 sekundi a ako je zona velika (2) stavis 30.
To sam gore I napomenuo da želim tako, ali mi je već default zauzimanje 30 sekundi. A da radim novi timer se ne isplati jer već imam jedan koji je dovoljan od 1 sekunde.
#define CAPTURE_TIME 30Godfather
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosAktivan Član
9 / 250 XP
Početnik(1)
2,044
Postovi:
55
Teme:
Pridružio se:Sep. 2013
10. Mar. 2019.
Jednostavno izracunaj obim zone
http://prntscr.com/mvvdkr - Zona 1 = 5, Zona 2 = 6 ...
Out:
[14:12:06] Zona 1: 200.00
[14:12:06] Zona 2: 216.00
[14:12:06] Zona 3: 343.00
[14:12:06] Zona 4: 501.00
http://prntscr.com/mvvdkr - Zona 1 = 5, Zona 2 = 6 ...
forward Float: returnZoneVolume(Float: minx, Float: miny, Float: maxx, Float: maxy);
main() {
printf("Zona 1: %.2f", returnZoneVolume(-643, 113.5, -543, 213.5));
printf("Zona 2: %.2f", returnZoneVolume(-543, 114.5, -469, 256.5));
printf("Zona 3: %.2f", returnZoneVolume(-469, 114.5, -243, 231.5));
printf("Zona 4: %.2f", returnZoneVolume(-643, 10.5, -245, 113.5));
}
Float: returnZoneVolume(Float: minx, Float: miny, Float: maxx, Float: maxy)
return floatabs(maxx-minx) + floatabs(maxy-miny);
Out:
[14:12:06] Zona 1: 200.00
[14:12:06] Zona 2: 216.00
[14:12:06] Zona 3: 343.00
[14:12:06] Zona 4: 501.00
Underboss
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosAktivan Član
199 / 250 XP
Početnik(1)
632
Postovi:
80
Teme:
Pridružio se:Avg. 2013
10. Mar. 2019.
Uradis po principu kao sto ti je XUNDER Rekao samo cuvas taj obim , i proveris tipa :
A pri tome mozes uraditi i da ti pri kreiranju zone cuva u varijablu koliki je obim same zone i onda mozes proveriti tipa :
CheckZone(minx,miny,maxx, maxy) < CheckZone(minx,miny,maxx, maxy) // 1 - prva zona , 2 - druga zonaA pri tome mozes uraditi i da ti pri kreiranju zone cuva u varijablu koliki je obim same zone i onda mozes proveriti tipa :
if(ZonaInfo < 2) { // Kod } // Da ako je manji od 2 to sto trazis da ti ide 15 sekundi taj kod Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
11. Mar. 2019.
Ja sam to mislio uraditi na ovaj naÄin.
U enum stavim ovako
I onda na kraj stavim valutu 1 to jest ako je zona mala.
I onda dolazi ovaj kod gdje se vrsi provjera.
Tu sam stavio ovaj kod ali nezz kako dalje.
A taj timer od 1 jedne sekunde poziva ovu funkciju kada igrac ude u CP.
@// xunder
U enum stavim ovako
enum E_CAPTURE_ZONE
{
E_CAPTURE_ZONE_SMALL
};
I onda na kraj stavim valutu 1 to jest ako je zona mala.
{"Military Shelter", {-153.3433,2213.3953,-99.2894,2319.2996}, {-126.7931,2257.9844,28.1627}, 6, 1},I onda dolazi ovaj kod gdje se vrsi provjera.
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for (new i; i < sizeof captureZone; i++)
{
if (checkpointid == captureZone)
{
if (IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_TOMATO, "* You cannot capture a zone in a vehicle.");
return 1;
}
if(AdminDuty == 1)
{
SendClientMessage(playerid, COLOR_TOMATO, "No way! You can't capture zone while on duty!");
return 1;
}
if(GetPlayerTeam(playerid) == captureZone)
{
SCM(playerid, COLOR_ORANGE_RED, "* This zone is controlled by your team.");
break;
}
if (captureZone == INVALID_PLAYER_ID)
{
if ((GetPlayerTeam(playerid) >= 0 && GetPlayerTeam(playerid) < sizeof TEAM) && TEAM[GetPlayerTeam(playerid)] && GetPlayerTeam(playerid) != captureZone)
{
captureZone = playerid;
captureZone = 1;
captureZone = 0;
KillTimer(captureZone);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
GangZoneFlashForAll(captureZone, ALPHA(TEAM[GetPlayerTeam(playerid)], 100));
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint to for "#CAPTURE_TIME" seconds to capture the zone.");
new string;
format(string, sizeof string, " "COL_WHITE"Someone is trying to capture "OLIVE_GREEN"%s "COL_WHITE"for team "DARK_RED"%s !", captureZone, TEAM[GetPlayerTeam(playerid)]);
SendClientMessageToAll(COLOR_DARK_RED, string);
}
else return 1;
}
else if (GetPlayerTeam(playerid) == GetPlayerTeam(captureZone))
{
captureZone++;
SCM(playerid, COLOR_GREEN, "* Stay in the checkpoint to assist your teammate in capturing the area.");
}
else if (captureZone == 1) //Ako je zona 1 to jest mala
{
//Nezz sto da sada uradim ovdje, jer inace CAPTURE_TIME je 30 sekundi.
}
PlayerTextDrawShow(playerid, capturePlayerTextDraw);
PlayerTextDrawShow(playerid, capturePlayerPreview);
ShowPlayerProgressBar(playerid, capturePlayerBar);
return 1;
}
}
return 1;
}Tu sam stavio ovaj kod ali nezz kako dalje.
else if (captureZone == 1) //Ako je zona 1 to jest mala
{
//Nezz sto da sada uradim ovdje, jer inace CAPTURE_TIME je 30 sekundi.
}
A taj timer od 1 jedne sekunde poziva ovu funkciju kada igrac ude u CP.
forward OnCaptureZoneUpdate(zoneid);
public OnCaptureZoneUpdate(zoneid)
{
captureZone += captureZone;
new string;
format(string, sizeof string, "Capturing %i...", CAPTURE_TIME - captureZone);
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
if (IsPlayerInDynamicCP(i, captureZone) &&
!IsPlayerInAnyVehicle(i) &&
GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
PlayerTextDrawSetString(i, capturePlayerTextDraw, string);
SetPlayerProgressBarValue(i, capturePlayerBar, captureZone);
}
}
if (captureZone > CAPTURE_TIME)
{
GetPlayerName(captureZone, string, MAX_PLAYER_NAME);
format(string, sizeof string, "* Good job soldier. You assisted %s to capture "LIGHT_GREEN"%s. +$500", string, captureZone);
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
if (IsPlayerInDynamicCP(i, captureZone) &&
!IsPlayerInAnyVehicle(i) &&
GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
PlayerTextDrawHide(i, capturePlayerTextDraw);
PlayerTextDrawHide(i, capturePlayerPreview);
HidePlayerProgressBar(i, capturePlayerBar);
if (i != captureZone)
{
SendClientMessage(i, COLOR_GREEN, string);
GivePlayerCash(i, 500);
}
}
if(GetPlayerTeam(i) == GetPlayerTeam(captureZone))
{
format(string, sizeof(string), "** You recieved +2 score from the captured zone by your team.");
SCM(i, COLOR_LIGHTBLUE, string);
SetPlayerScore(i, PInfo += 2);
}
if(GetPlayerTeam(i) == captureZone)
{
format(string, sizeof(string), "** You recieved -2 score, your team lost the zone.");
SCM(i, COLOR_LIGHTBLUE, string);
SetPlayerScore(i, PInfo -= 2);
}
}
SetPlayerScore(captureZone, GetPlayerScore(captureZone) + 5);
GivePlayerCash(captureZone, 4500);
format(string, sizeof string, " You successfully captured "COL_ORANGE"%s. "COL_WHITE"+5 Score +$4500", captureZone);
SendClientMessage(captureZone, COLOR_GREEN, string);
PInfo[captureZone]++;
format(string, sizeof string, ""COL_ORANGE"(!) %s team have captured '%s' .", TEAM[GetPlayerTeam(captureZone)], captureZone);
SCMToAll(-1, string);
new text;
format(text, sizeof(text), ""COL_WHITE"%s"COL_YELLOW"(%i)", captureZone, zoneid);
UpdateDynamic3DTextLabelText(captureZone, TEAM[captureZone], text);
captureZone = GetPlayerTeam(captureZone);
captureZone = INVALID_PLAYER_ID;
KillTimer(captureZone);
GangZoneStopFlashForAll(captureZone);
GangZoneShowForAll(captureZone, ALPHA(TEAM[captureZone], 100));
}
return 1;
}@// xunder
Underboss
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosAktivan Član
199 / 250 XP
Početnik(1)
632
Postovi:
80
Teme:
Pridružio se:Avg. 2013
11. Mar. 2019.
Ne mozes koristiti CAPTURE_TIME KAO DEFINE , vec ti se mora time nalaziti kao varijabla u tvojoj zoni , tipa captureZone
i onda uradis ovo
i onda uradis ovo
else if (captureZone == 1) //Ako je zona 1 to jest mala
{
captureZone = 15; // i onda pozoves onaj timer preuredis ga za ovo
}
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
11. Mar. 2019.
Ne može tako, jer to nije naÄin koji ja želim. Jedino onda preostaje da se moze napraviti da svaka zona ima svoje vrijeme za capture. Npr:
{"Military Shelter", {-153.3433,2213.3953,-99.2894,2319.2996}, {-126.7931,2257.9844,28.1627}, 6, 30}, //30 sekundi
{"Surf", {-153.3433,2213.3953,-99.2894,2319.2996}, {-126.7931,2257.9844,28.1627}, 6, 15}, //15 sekundi.
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
368
Postovi:
31
Teme:
Pridružio se:Dec. 2018
11. Mar. 2019.
Evo ovako, uradio sam na ovaj naÄin ali iz nekog razlog ne pocinje zauzimanje od 20.. nego krene 9..8.. I tako dalje. I onda mi salje ovu gore poruku a nebi trebalo.
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint to for "#CAPTURE_TIME" seconds to capture the zone.");
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for (new i; i < sizeof captureZone; i++)
{
if (checkpointid == captureZone)
{
if (IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_TOMATO, "* You cannot capture a zone in a vehicle.");
return 1;
}
if(AdminDuty == 1)
{
SendClientMessage(playerid, COLOR_TOMATO, "No way! You can't capture zone while on duty!");
return 1;
}
if(GetPlayerTeam(playerid) == captureZone)
{
SCM(playerid, COLOR_ORANGE_RED, "* This zone is controlled by your team.");
break;
}
if (captureZone == INVALID_PLAYER_ID)
{
if ((GetPlayerTeam(playerid) >= 0 && GetPlayerTeam(playerid) < sizeof TEAM) && TEAM[GetPlayerTeam(playerid)] && GetPlayerTeam(playerid) != captureZone)
{
captureZone = playerid;
captureZone = 1;
captureZone = 0;
KillTimer(captureZone);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
GangZoneFlashForAll(captureZone, ALPHA(TEAM[GetPlayerTeam(playerid)], 100));
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint to for "#CAPTURE_TIME" seconds to capture the zone.");
new string;
format(string, sizeof string, " "COL_WHITE"Someone is trying to capture "OLIVE_GREEN"%s "COL_WHITE"for team "DARK_RED"%s !", captureZone, TEAM[GetPlayerTeam(playerid)]);
SendClientMessageToAll(COLOR_DARK_RED, string);
}
else return 1;
}
else if (GetPlayerTeam(playerid) == GetPlayerTeam(captureZone))
{
captureZone++;
SCM(playerid, COLOR_GREEN, "* Stay in the checkpoint to assist your teammate in capturing the area.");
}
if (captureZone == 1 )
{
captureZone = 20;
KillTimer(captureZone);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint for 20 seconds to capture the zone.");
}
PlayerTextDrawShow(playerid, capturePlayerTextDraw);
PlayerTextDrawShow(playerid, capturePlayerPreview);
ShowPlayerProgressBar(playerid, capturePlayerBar);
return 1;
}
}
return 1;
}
if (captureZone == 1 )
{
captureZone = 20;
KillTimer(captureZone);
captureZone = SetTimerEx("OnCaptureZoneUpdate", 1000, true, "i", i);
SCM(playerid, COLOR_ORANGE_RED, "Stay in the checkpoint for 20 seconds to capture the zone.");
}
Shot Caller
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
171
Postovi:
26
Teme:
Pridružio se:Okt. 2015
11. Mar. 2019.
Chuffy wrote on March 10, 2019, 12:03 pm:
To sam gore I napomenuo da želim tako, ali mi je već default zauzimanje 30 sekundi. A da radim novi timer se ne isplati jer već imam jedan koji je dovoljan od 1 sekunde.
#define CAPTURE_TIME 30Pa onda ti uzmes i napravis jos define-a tipa capture_time_small
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava