GangZone Color Zone [HELP]
#1

Код:
#define FILTERSCRIPT

#include <a_samp>

// ----- Variables

#define MAX_GANGZONES   15

new Checkpoint[MAX_PLAYERS];
new GroveTurf;
new timer;

// ----- Callbacks

public OnFilterScriptInit()
{
	GroveTurf = GangZoneCreate(2402.546, -1737.13, 2604.096, -1630.541); // Creating the GangZone
	GangZoneShowForAll(GroveTurf, 0x00FF007A);
	return 1;
}

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

public OnPlayerSpawn(playerid)
{
    SetPlayerCheckpoint(playerid, 2487.0391,-1668.5784,13.3438,8);
	SetPlayerColor(playerid, 0xFF80FFFF); // Pink
	return 1;
}

public OnPlayerEnterCheckpoint(playerid) // If the player enters a particluar checkpoint
{
	SendClientMessage(playerid, 0x00FF007A, "Please Wait 20 Seconds - To Caputre this turf."); // Telling the player to wait 20 seconds.
	GangZoneFlashForAll(GroveTurf,  0xFF80FF76); // Makes the turf Flash Pink ( telling everyone its being taken over )
	SendClientMessageToAll(0xFF80FFFF, "The Grove Street Turf is being taken over"); // Sending Message to all players.
	timer = SetTimerEx("SetZone", 20000, false, "i", playerid); // Setting the Timer... ( 20 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, "ERROR : You have left the checkpoint");
		GangZoneStopFlashForAll(GroveTurf);
		SendClientMessageToAll(0x00FF007A, "The Grove Street Turf is now safe");
		KillTimer(timer);
		Checkpoint[playerid] = 0;
	}
	else
	{
	    // nothing
	}
	return 1;
}

// Custom Callbacks

forward SetZone(playerid);
public SetZone(playerid)
{
	if(Checkpoint[playerid] == 1)
	{
		GangZoneStopFlashForAll(GroveTurf); // Stopping it Flashing.
		GangZoneHideForAll(GroveTurf); // Hiding the GangZone
		GangZoneShowForAll(GroveTurf, 0xFF80FF76); // Showing the GangZone with the new colour
		SendClientMessageToAll(0x00FF007A, "The Grove Street Turf, has been sucessfully taken over");
		Checkpoint[playerid] = 0;
		// You could delete the check point then make it spawn again in 10 minutes or something...
	}
	return 1;
}
Ok now see, that OnPlayerSpawn the color is pink. Now how do I when player enter checkpoint, (the player has a different color.) Can it GetPlayerColor and set that color to flash... Can it be possible?
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerColor

GangZoneFlashForAll(gangzone, GetPlayerColor(playerid));
Reply
#3

Thanks, alot. Really thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)