need last help on capture zones
#1

ok here is my filterscript and two things are wrong
1.i cant see the checkpoint
2. A player can capture checkpoint anytime everytime so i want if player team has already captured the checkpoint he cant capture instead other teams will capture
pawn Code:
#pragma unused ret_memcpy
#include <a_samp>
#include <colors>
#include <Dudb>
#include <Dini>
#include <MidoStream>
#include <a_npc>
#include <foreach>
#include <JunkBuster> // Anti cheat
#include <VehicleHealthBar>
#include <bodyparts>

// Define all the callbacks I need
#define TEAM_USA 1
#define TEAM_COLOR_USA COLOR_BLUE
#define TEAM_JAPAN 2
#define TEAM_COLOR_JAPAN COLOR_WHITE
#define TEAM_GERMANY 3
#define TEAM_COLOR_GERMANY COLOR_BROWN
#define TEAM_RUSSIA 4
#define TEAM_COLOR_RUSSIA COLOR_RED
#define TEAM_ENGLAND 5
#define TEAM_COLOR_ENGLAND COLOR_PLUM
#define TEAM_PAKISTAN 6
#define TEAM_COLOR_PAKISTAN COLOR_LIMEGREEN
#define TEAM_INDIA 7
#define TEAM_COLOR_INDIA COLOR_CORAL
#define TEAM_BRAZIL 8
#define TEAM_COLOR_BRAZIL COLOR_AQUA
#define TEAM_FRANCE 9
#define TEAM_COLOR_FRANCE COLOR_INDIGO
#define TEAM_INDONESIA 10
#define TEAM_COLOR_INDONESIA COLOR_BISQUE

// ----- Variables

#define MAX_GANGZONES   15

new Checkpoint[MAX_PLAYERS];
new gangzone;
new timer;
new gTeam[MAX_PLAYERS];
// ----- Callbacks

public OnFilterScriptInit()
{
    gangzone = GangZoneCreate(841.9067, 1674.394, 1076.198, 2007.047); // Creating the GangZone
    GangZoneShowForAll(gangzone, 0x00FF007A);
    return 1;
}

public OnFilterScriptExit()
{
    GangZoneDestroy(gangzone);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerCheckpoint(playerid, 970.7667, 1976.103, 15, 5); //PINK
    return 1;
}

public OnPlayerEnterCheckpoint(playerid) // If the player enters a particluar checkpoint
{
    SendClientMessage(playerid, 0x00FF007A, "Wait 30 Seconds - To Caputre this gangzone."); // Telling the player to wait 30 seconds.
    GangZoneFlashForAll(gangzone,  0xFF80FF76); // Makes the turf Flash Pink ( telling everyone its being taken over )
    SendClientMessageToAll(0xFF80FFFF, "The gangzone is being taken over"); // Sending Message to all players.
    timer = SetTimerEx("SetZone", 30000, false, "i", playerid); // Setting the Timer... ( 30 seconds )
    Checkpoint[playerid] = 1; // Telling the variable that the player is in the checkpoint.
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
        SendClientMessage(playerid, 0x00FF007A, " You have left the checkpoint , You have failed to capture");
        GangZoneStopFlashForAll(gangzone);
        SendClientMessageToAll(0x00FF007A, "gangzone was not taken over");
        KillTimer(timer);
        Checkpoint[playerid] = 0;
    }
    else
    {
        // nothing
    }
    return 1;
}

// Custom Callbacks

forward SetZone(playerid);
public SetZone(playerid)
{
    gTeam[playerid] = TEAM_USA;
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_USA);
    }
    if(gTeam[playerid] == TEAM_JAPAN)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_JAPAN);
    }
    if(gTeam[playerid] == TEAM_GERMANY)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_GERMANY);
    }
    if(gTeam[playerid] == TEAM_RUSSIA)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_RUSSIA);
    }
    if(gTeam[playerid] == TEAM_ENGLAND)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_ENGLAND);
    }
    if(gTeam[playerid] == TEAM_PAKISTAN)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_PAKISTAN);
    }
    if(gTeam[playerid] == TEAM_FRANCE)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_FRANCE);
    }
    if(gTeam[playerid] == TEAM_INDIA)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_INDIA);
    }
    if(gTeam[playerid] == TEAM_BRAZIL)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_BRAZIL);
    }
    if(gTeam[playerid] == TEAM_INDONESIA)
    {
        GangZoneShowForAll(gangzone,TEAM_COLOR_INDONESIA);
        return 1;
}
    if(Checkpoint[playerid] == 1)
    {
        GangZoneStopFlashForAll(gangzone); // Stopping it Flashing.
        GangZoneHideForAll(gangzone); // Hiding the GangZone
        GangZoneShowForAll(gangzone, 0xFF80FF76); // Showing the GangZone with the new colour
        SendClientMessageToAll(0x00FF007A, "gangzone Has Been Captured By Attacker");
        SetPlayerScore(playerid,GetPlayerScore(playerid)+5 );
        GivePlayerMoney(playerid,6000);
        SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        Checkpoint[playerid] = 0;
        // You could delete the check point then make it spawn again in 10 minutes or something...
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)