GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: inf - 2014. március 10. - 18:19:26

Cím: terület foglalás
Írta: inf - 2014. március 10. - 18:19:26
Üdv.
Írtam egy terület foglalós scriptet de valahogy nem akar összejönni hogy villogjon amikor a játékos belép a zónába. Valaki átnézné a scriptem és elmondaná hogy mi a probléma vele?
Script:
 
public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(areaid == SzerverInfo[GangZone1Terulet])
    {
        if(SzerverInfo[GangZone1Team] != JatekosInfo[playerid][JatekMode])
        {
   SzerverInfo[GangZone1Join]++;
}
    }
    if(areaid == SzerverInfo[GangZone2Terulet])
    {
        if(SzerverInfo[GangZone2Team] != JatekosInfo[playerid][JatekMode])
        {
   SzerverInfo[GangZone2Join]++;
}
    }
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == SzerverInfo[GangZone1Terulet])
    {
        if(SzerverInfo[GangZone1Team] != JatekosInfo[playerid][JatekMode])
        {
           SzerverInfo[GangZone1Join]--;
}
    }
    if(areaid == SzerverInfo[GangZone2Terulet])
    {
        if(SzerverInfo[GangZone2Team] != JatekosInfo[playerid][JatekMode])
        {
           SzerverInfo[GangZone2Join]--;
}
    }
return 1;
}
public globaltimer()
{
    if(SzerverInfo[GangZone1Join] >= 2)
{
if(SzerverInfo[GangZone1Team] == 1)
    {
       GangZoneFlashForAll(SzerverInfo[GangZone1], 0xFF000090);
    }
    if(SzerverInfo[GangZone1Team] == 2)
    {
        GangZoneFlashForAll(SzerverInfo[GangZone1], 0x001EFF90);
    }
    if(SzerverInfo[GangZone1Timer] == 0)
    {
   SzerverInfo[GangZone1Count]=60;
}
SzerverInfo[GangZone1Timer]=1;
}
if(SzerverInfo[GangZone1Join] < 2)
{
GangZoneStopFlashForAll(SzerverInfo[GangZone1]);
SzerverInfo[GangZone1Timer]=0;
}
if(SzerverInfo[GangZone1Timer] == 1)
{
    SzerverInfo[GangZone1Count]--;
if(SzerverInfo[GangZone1Count] == 0)
{
    SzerverInfo[GangZone1Timer]=0;
    GangZoneStopFlashForAll(SzerverInfo[GangZone1]);
    if(SzerverInfo[GangZone1Team] == 1)
    {
       GangZoneShowForAll(SzerverInfo[GangZone1], 0xFF000090);
       SzerverInfo[GangZone1Team]=2;
    }
    if(SzerverInfo[GangZone1Team] == 2)
    {
        GangZoneShowForAll(SzerverInfo[GangZone1], 0x001EFF90);
        SzerverInfo[GangZone1Team]=1;
    }
}
}
return 1;
}
Cím: terület foglalás
Írta: bbTamas - 2014. március 10. - 19:08:30
GangZoneFlashForAll függvény használatával alapból villog a bandazóna nem kell hozzá idõzítõ!
Elöszõr GangZoneShowForAll utána GangZoneFlashForAll használd, és villógni fog a zóna.
Cím: terület foglalás
Írta: Flash - 2014. március 11. - 06:56:04
Tessék, még egyszerüsítettem is neked ;)
 
public OnPlayerEnterDynamicArea(playerid, areaid) {
if(areaid == SzerverInfo[GangZone1Terulet] && SzerverInfo[GangZone1Team] != JatekosInfo[playerid][JatekMode]) SzerverInfo[GangZone1Join]++;
    if(areaid == SzerverInfo[GangZone2Terulet] && SzerverInfo[GangZone2Team] != JatekosInfo[playerid][JatekMode]) SzerverInfo[GangZone2Join]++;
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid) {
    if(areaid == SzerverInfo[GangZone1Terulet] && SzerverInfo[GangZone1Team] != JatekosInfo[playerid][JatekMode]) SzerverInfo[GangZone1Join]--;
    if(areaid == SzerverInfo[GangZone2Terulet] && SzerverInfo[GangZone2Team] != JatekosInfo[playerid][JatekMode]) SzerverInfo[GangZone2Join]--;
return 1;
}
public globaltimer() {
    if(SzerverInfo[GangZone1Join] >= 2) {
if(SzerverInfo[GangZone1Team] == 1) GangZoneFlashForAll(SzerverInfo[GangZone1], 0xFF000090);
if(SzerverInfo[GangZone1Team] == 2) GangZoneFlashForAll(SzerverInfo[GangZone1], 0x001EFF90);
        if(!SzerverInfo[GangZone1Timer]) SzerverInfo[GangZone1Count] = 60;
SzerverInfo[GangZone1Timer] = 1;
}
if(SzerverInfo[GangZone1Join] < 2) {
        GangZoneStopFlashForAll(SzerverInfo[GangZone1]);
        SzerverInfo[GangZone1Timer]=0;
}
if(SzerverInfo[GangZone1Timer] == 1) SzerverInfo[GangZone1Count]--;
     if(!SzerverInfo[GangZone1Count]) {
         SzerverInfo[GangZone1Timer] = 0;
         GangZoneStopFlashForAll(SzerverInfo[GangZone1]);
}
if(SzerverInfo[GangZone1Team] == 1) {
       GangZoneShowForAll(SzerverInfo[GangZone1], 0xFF000090);
GangZoneFlashForAll(SzerverInfo[GangZone1], 0xFF000090);
         SzerverInfo[GangZone1Team] = 2;
}
     if(SzerverInfo[GangZone1Team] == 2) {
         GangZoneShowForAll(SzerverInfo[GangZone1], 0x001EFF90);
GangZoneFlashForAll(SzerverInfo[GangZone1], 0x001EFF90);
        SzerverInfo[GangZone1Team] = 1;
     }
return 1;
}
Cím: terület foglalás
Írta: inf - 2014. március 11. - 19:31:54
Most már villog. Csak most meg már ezzel van a baj.
 
if(SzerverInfo[Zone2Team] == 2)
{
       GangZoneShowForAll(SzerverInfo[Zone2], 0x001EFF90);
       SzerverInfo[Zone2Team]=1;
}
if(SzerverInfo[Zone2Team] == 1)
{
       GangZoneShowForAll(SzerverInfo[Zone2], 0xFF000090);
       SzerverInfo[Zone2Team]=2;
}

 
Hogyha a terroristáké volt eddig a terület ( if(SzerverInfo[Zone2Team] == 2) ) akkor átállítja a terület szinét kékre és a terület ID-jét átállítja a katonákére. Csakhogyha átállítja a katonákéra akkor a következõ is le fog futni pedig az csak arra az esetre van ha a katonáké volt a terület és a terroristák foglalták el. Nah ezt kellene valahogy megoldani hogyha az elsõ if helyes akkor ne fusson tovább a másodikra.
Cím: terület foglalás
Írta: Dfoglalo - 2014. március 11. - 20:39:07
Erre találták fel a többirányú elágazásokat.
 
if(SzerverInfo[Zone2Team] == 2)
{
       GangZoneShowForAll(SzerverInfo[Zone2], 0x001EFF90);
       SzerverInfo[Zone2Team]=1;
}
else if(SzerverInfo[Zone2Team] == 1)
{
       GangZoneShowForAll(SzerverInfo[Zone2], 0xFF000090);
       SzerverInfo[Zone2Team]=2;
}
Cím: terület foglalás
Írta: inf - 2014. március 11. - 22:22:44
Ez sem jó :(
Cím: terület foglalás
Írta: Dfoglalo - 2014. március 11. - 23:36:39
Akkor valamit elrontottál, mert ez jó :)