-
Ü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;
}
-
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.
-
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;
}
-
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.
-
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;
}
-
Ez sem jó :(
-
Akkor valamit elrontottál, mert ez jó :)