gangzone. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: gangzone. (
/showthread.php?tid=378042)
gangzone. -
newbienoob - 16.09.2012
I'm facing this problem since the first time I tried to create a captureable gangzone. I've created it and everything is perfect. But I can't fix this 1 little problem. After I captured a gangzone, it changed the color to my team's color. No problem here. But after I reconnect, gangzone color is not changed.
pawn Код:
//at the top
#define usacolor 0x0000FF96
new zone1;
new capturing[MAX_PLAYERS];
new timerid;
new pickup1;
new timer = 10;
new team[MAX_PLAYERS];
#define usa 1
//ongamemodeinit
zone1 = GangZoneCreate(-611.5824, 2530.2256,-500.5136, 2627.2539);
pickup1 = CreateDynamicPickup(1313,19,-562.2616,2591.2383,53.5156,_,_,_,100);
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(pickupid == pickup1)
{
if(team[playerid] == usa)
{
SendClientMessage(playerid,-1,"capturing...");
GangZoneFlashForAll(zone1,usacolor);
timerid = SetTimerEx("setzone",1000,true,"i",playerid);
capturing[playerid] = 1;
}
}
return 1;
}
forward setzone(playerid);
public setzone(playerid)
{
timer--;
if(timer == 0)
{
KillTimer(timerid);
GivePlayerMoney(playerid,100);
capturing[playerid] = 0;
if(team[playerid] == usa)
{
GangZoneShowForAll(zone1,usacolor);
}
}
return 1;
}
Does anyone know how to fix this problem?
Re: gangzone. -
arvifilter - 16.09.2012
Well you need to add some lines:
first a variable to define if the area is captured by USA or not:
on top of the script
then at the OnGameModeInit:
Код:
AreaUSA = 0;//not captured
and at the OnPlayerConnect:
Код:
if(AreaUSA == 0)
{
GangZoneFlashForAll(zone1,any desired color);
return 1;
}
else
{
GangZoneFlashForAll(zone1,usacolor);
return 1;
}
and at the timer(under the gang zone flash):