Help with Gang Zones
#1

Hi everybody:
I made for my TDM Server a script that when you take a pickup the zone changes the color to the gang you're in.
It works perfect but the problem right now is, for example Killers have taken over the Workers zone and a new Player Joins the server and selects Workers, the gang zone changes the color to Workers again like it was in the begging, so the killers have to get the pick up again to change it to their color.
I made it with GangzoneShowForAll otherwise it would show for one player only in the team, here is the code to understand it better.

Thats under on player spawn
Code:
public OnPlayerSpawn(playerid){
	if(gTeam[playerid] == TEAM_TRABAJADORES) {
	GangZoneShowForAll(Trabajadores,COLOR_GREEN);
	SetPlayerColor(playerid,COLOR_GREEN); // GREEN
	GivePlayerWeapon(playerid, 6,1);
	GivePlayerWeapon(playerid, 22,250);
	GivePlayerWeapon(playerid, 25,250);
	GivePlayerWeapon(playerid, 32,450);
	GivePlayerWeapon(playerid, 30,250);
		}

	else if(gTeam[playerid] == TEAM_EMPRESARIOS) {
	GangZoneShowForAll(Empresarios,COLOR_PURPLE);
	SetPlayerColor(playerid,COLOR_PURPLE); // PURPLE
	GivePlayerWeapon(playerid, 2,1);
	GivePlayerWeapon(playerid, 23,250);
	GivePlayerWeapon(playerid, 25,250);
	GivePlayerWeapon(playerid, 28,450);
	GivePlayerWeapon(playerid, 30,250);
		}
	return 1;}
Thats under onplayerpickup
Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if (pickupid == zonatrabaj && gTeam[playerid] == TEAM_TRABAJADORES){
	GangZoneShowForAll(Trabajadores,COLOR_GREEN);
 	}
	if (pickupid == zonatrabaj && gTeam[playerid] == TEAM_EMPRESARIOS){
	GangZoneShowForAll(Trabajadores,COLOR_PURPLE);
 	}
	return 1;
 }
What i want is that when a player spawns the zone stays the same color as it as taken from the killers
If somebody could help me out would be very nice
Thanks
Reply
#2

try removing `GangZoneShowForAll` from onplayer spawn
Reply
#3

if i do it the gang zones doesn't appear, only after i grab the pickup but still not for the players that conect only those who are conected
Reply
#4

Use GangZoneShowForPlayer, not GangZoneShowForAll
Reply
#5

Quote:
Originally Posted by Jakku
Use GangZoneShowForPlayer, not GangZoneShowForAll
Like i said GangZoneShowForPlayer only shows to the player who gets the pickup the same with the spawn, it will show green to the player who conects to the server not for the other players that already connected that's why I used GangZoneShowForAll

What im thinking is put a code like this

Code:
public OnPlayerSpawn(playerid){
	if(gTeam[playerid] == TEAM_TRABAJADORES) {
     if(Zonetrabajtaken[playerid] == 0) return GangZoneShowForPlayer(playerid,Trabajadores,COLOR_GREEN);
return 1;}
Under onplayerpickup
Code:
	if (pickupid == zonatrabaj && gTeam[playerid] == TEAM_TRABAJADORES){
	GangZoneShowForAll(Trabajadores,COLOR_GREEN);
    Zonetrabajtaken[playerid] == 0
 	}
	if (pickupid == zonatrabaj && gTeam[playerid] == TEAM_EMPRESARIOS){
	GangZoneShowForAll(Trabajadores,COLOR_PURPLE);
    Zonetrabajtaken[playerid] == 1
 	}
If I'm not wrong it should work I have to try it out
I don't know what you guys suggest
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)