Wrong player colors
#1

Hello community,

I'm pretty new to SA-MP scripting. Well, i decided to make a Grove vs Ballas simple TDM mode, now THATS a new idea, huh
So anyway, i started to do this and everything works well. But my team colors are not working correctly. When i am Grove i have a green nametag, which is good, but when i'm Ballas, i also have a green tag. So that's the problem. Now i guess its my scripting fault. Could you have a look, please? I would be so happy if you helped me!
Pastebin: http://pastebin.com/SzpDtDEN

Cluck-a-doodle,

Sydcul your little clucker friend, which seems to give enough information about how new i am on this forum and how non-rude you should be.
Reply
#2

Okay ill tried something but I could not compile it and try it out.. I am not at my computer so I made this in notepad :P
Код:
#include <a_samp>
#include "../include/gl_common.inc"

#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_GROVE_COLOR 0x00FF00AA
#define TEAM_BALLAS_COLOR 0xFF00FFA

new total_vehicles_from_files=0;
new gTeam[MAX_PLAYERS];
new bTeam[MAX_PLAYERS];

main()
{
	print("\n----------------------------------");
	print(" Grove vs Ballas by Sydcul");
	print("----------------------------------\n");
}

public OnGameModeInit()
{
	SetGameModeText("Grove vs Ballas");
	AddPlayerClass(105, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
	AddPlayerClass(106, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
	AddPlayerClass(107, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
	AddPlayerClass(102, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);
	AddPlayerClass(103, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);
	AddPlayerClass(104, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);	
	total_vehicles_from_files += LoadStaticVehiclesFromFile("tdm/vehicles.txt");
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
    {
	SetPlayerPos(playerid, 2121.7322, -1623.2563, 26.8368);
	SetPlayerFacingAngle(playerid, 60.2360);
	SetPlayerCameraPos(playerid, 2111.9089 ,-1623.7340, 24.2307);
	SetPlayerCameraLookAt(playerid, 2121.7322, -1623.2563, 26.8368);
	switch(classid)
    {
    case 0,1,2:
    {
	GameTextForPlayer(playerid, "~g~GROVE~w~", 3000, 5);
        SetPlayerTeam(playerid, TEAM_GROVE);
        gTeam[playerid] = TEAM_GROVE;
        SetPlayerColor(playerid, TEAM_GROVE_COLOR);
    }
    case 3,4,5:
    {
	GameTextForPlayer(playerid, "~b~BALLAS~w~", 3000, 5);
	SetPlayerTeam(playerid, TEAM_BALLAS);
        bTeam[playerid] = TEAM_BALLAS;
        SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
	}
    }
    return 1;
}


SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == TEAM_GROVE)
	{
		SetPlayerColor(playerid, TEAM_GROVE_COLOR);
	}
	else if (bTeam[playerid] == TEAM_BALLAS)
	{
		SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
	}
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
 	SetPlayerToTeamColor(playerid);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
tell me how it went
Reply
#3

You simply mistyped the color code.
pawn Код:
0xFF00FFA
This gets interpreted as 0x0FF00FFA, which happens to be bright green.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
You simply mistyped the color code.
pawn Код:
0xFF00FFA
This gets interpreted as 0x0FF00FFA, which happens to be bright green.
Ok, well that's my bad then. Haha. Thanks for the reply, tho! Sometimes you need someone other than yourself to look at it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)