Jump to content
  • 0

pomoc Zóny


_VaNovec_

Dotaz

Zdravím , našiel som návod na SAMP fóre na toto :

 

#include

#define TEAM_GROVE 1

#define TEAM_BALLAS 2

#define TEAM_VAGOS 3

#define MIN_MEMBERS_TO_START_WAR 1

#define TAKEOVER_TIME 120

#define MIN_DEATHS_TO_START_WAR 1

enum eZone

{

Float:zMinX,

Float:zMinY,

Float:zMaxX,

Float:zMaxY,

zTeam

}

new ZoneInfo[][eZone] = {

{2337.9004,-1808.8383,2590.2043,-1610.3673,TEAM_GROVE},

{2084.7,-1808.8383,2337.9004,-1610.3673,TEAM_BALLAS},

{2590.2043,-1808.8383,2842.3,-1610.3673,TEAM_VAGOS}

};

new ZoneID[sizeof(ZoneInfo)];

 

new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};

new ZoneAttackTime[sizeof(ZoneInfo)];

new ZoneDeaths[sizeof(ZoneInfo)];

new Teams[] = {

TEAM_GROVE,

TEAM_BALLAS,

TEAM_VAGOS

};

 

public OnFilterScriptInit()

{

for(new i=0; i < sizeof(ZoneInfo); i++)

{

ZoneID = GangZoneCreate(ZoneInfo[zMinX], ZoneInfo[zMinY], ZoneInfo[zMaxX], ZoneInfo[zMaxY]);

}

 

AddPlayerClass(107,1429.3770,-1732.4554,13.3828,355.2560,0,0,0,0,0,0); // example min

SetTimer("ZoneTimer", 1000, true);

 

print("\n--------------------------------------");

print(" Blank Filterscript by your name here");

print("--------------------------------------\n");

return 1;

}

 

public OnFilterScriptExit()

{

return 1;

}

 

public OnPlayerSpawn(playerid)

{

for(new i=0; i < sizeof(ZoneInfo); i++)

{

GangZoneShowForPlayer(playerid, ZoneID, GetTeamZoneColor(ZoneInfo[zTeam]));

}

for(new i=0; i < sizeof(ZoneInfo); i++)

{

GangZoneShowForPlayer(playerid, ZoneID, GetTeamZoneColor(ZoneInfo[zTeam]));

if(ZoneAttacker != -1) GangZoneFlashForPlayer(playerid, ZoneID, GetTeamZoneColor(ZoneAttacker));

}

return 1;

}

 

public OnPlayerDeath(playerid, killerid, reason)

{

if(IsPlayerConnected(killerid) && GetPlayerTeam(playerid) != GetPlayerTeam(killerid)) // not a suicide or team kill

{

new zoneid = GetPlayerZone(playerid);

if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == GetPlayerTeam(playerid))

{

ZoneDeaths[zoneid]++;

if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)

{

ZoneDeaths[zoneid] = 0;

ZoneAttacker[zoneid] = GetPlayerTeam(killerid);

ZoneAttackTime[zoneid] = 0;

GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));

}

}

}

return 1;

}

 

 

 

public ZoneTimer()

{

for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones

{

if(ZoneAttacker != -1) // zone is being attacked

{

if(GetPlayersInZone(i, ZoneAttacker) >= MIN_MEMBERS_TO_START_WAR)

{

ZoneAttackTime++;

if(ZoneAttackTime == TAKEOVER_TIME)

{

GangZoneStopFlashForAll(ZoneID);

ZoneInfo[zTeam] = ZoneAttacker;

GangZoneShowForAll(ZoneID, GetTeamZoneColor(ZoneInfo[zTeam])); // update the zone color for new team

ZoneAttacker = -1;

}

}

else // attackers failed to take over the zone

{

GangZoneStopFlashForAll(ZoneID);

ZoneAttacker = -1;

}

}

else // check if somebody is attacking

{

for(new t=0; t < sizeof(Teams); t++)

{

if(Teams[t] != ZoneInfo[zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR)

{

ZoneAttacker = Teams[t];

ZoneAttackTime = 0;

GangZoneFlashForAll(ZoneID, GetTeamZoneColor(ZoneAttacker));

}

}

}

}

}

 

 

 

 

stock GetTeamZoneColor(teamid)

{

switch(teamid)

{

case TEAM_GROVE: return 0x00FF0088;

case TEAM_BALLAS: return 0xFF00FF88;

case TEAM_VAGOS: return 0xFFFF0088;

}

return -1;

}

 

stock IsPlayerInZone(playerid, zoneid)

{

new Float:x, Float:y, Float:z;

GetPlayerPos(playerid, x, y, z);

return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);

}

 

stock GetPlayersInZone(zoneid, teamid)

{

new count;

for(new i=0; i < MAX_PLAYERS; i++)

{

if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid))

{

count++;

}

}

return count;

}

 

stock GetPlayerZone(playerid)

{

for(new i=0; i < sizeof(ZoneInfo); i++)

{

if(IsPlayerInZone(playerid, i))

{

return i;

}

}

return -1;

}

 

 

 

ale neukladá mi to zóny , po resete serveru sa mi vymažú , prosím pomoc ale nepíšte mi že použi tú a tú funkciu prosím dokial mi to nikdo neukáže tu funkiu neviem používať , dakujem ;)

Link to comment
Share on other sites

0 odpovědí na tuto otázku

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...