09.09.2016, 07:03
Hi guys. Having a weird problem. One of those problems which is an obvious fix. I have Textdraws on class selection, however it's the font color that's having an issue. So when you first connect, the Textdraw will start as the color it is created as (instead of defined in the first class), and when you go to the next class, it will use the previous class color, and if you go back, it'll use the next class color. I'll try and explain in a step-by-step description, but here's the code:
OnGameModeInit:
So when I first connect, the textdraw color is what it is created as.
Then if I go to the next class (ballas), it changes to the first class (grove), then if i go the next class (aztecas), it changes to the previous class (ballas). How ever, everything else in the class selection works, so if I'm looking at the grove class, it's got the correct camera position and text, if i'm looking at the ballas class it's got the correct camera position and text etc. the only thing that isn't correct is the text color? How weird
OnGameModeInit:
pawn Код:
teamGrove = Class_Add(105, 2493.9133, -1682.3986, 13.3382, 0.0, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamBallas = Class_Add(102, 2005.2261, -1119.7739, 26.7813, 172.7240, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamAztecas = Class_Add(114, 2652.2991, -2012.1755, 13.5547, 296.3887, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamVagos = Class_Add(108, 1883.0979, -2002.1365, 13.5469, 178.5362, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamNang = Class_Add(121, 1617.1896, -1843.7661, 13.5332, 204.6284, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamRifa = Class_Add(173, 310.1770, -1770.2499, 4.5789, 233.9678, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamBikers = Class_Add(254, 681.0540,-476.5241,16.3359,177.9371, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamRMafia = Class_Add(111, 1025.9265, -1123.8169, 23.8770, 197.2713, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
teamPolice = Class_Add(281, 1583.7803, -1631.9534, 13.3828, 73.0974, WEAPON_MP5, 500, WEAPON_ARMOUR, 50);
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
new string[124];
TextDrawShowForPlayer(playerid, classSelectionTextdraw1[playerid]);
TextDrawShowForPlayer(playerid, classSelectionTextdraw2[playerid]);
TextDrawShowForPlayer(playerid, classSelectionTextdraw3[playerid]);
TextDrawShowForPlayer(playerid, classSelectionTextdraw4[playerid]);
TextDrawShowForPlayer(playerid, classSelectionTextdraw5[playerid]);
if(classid == teamGrove)
{
SetPlayerPos(playerid, 2458.6174, -1696.0648, 0.0);
SetPlayerCameraPos(playerid, 2458.278, -1684.794, 28.413);
SetPlayerCameraLookAt(playerid, 2493.913, -1682.398, 13.338);
format(string, sizeof(string), "Grove St. Families");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_GROVE);
}
if(classid == teamBallas)
{
SetPlayerPos(playerid, 1985.7264, -1143.9445, 0.00);
SetPlayerCameraPos(playerid, 1975.772, -1150.537, 32.866);
SetPlayerCameraLookAt(playerid,1992.586, -1140.681, 25.529);
format(string, sizeof(string), "Glen Park Ballas");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_BALLAS);
}
if(classid == teamAztecas)
{
SetPlayerPos(playerid, 2697.3435, -1985.8120, -5.00);
SetPlayerCameraPos(playerid, 2702.148, -1992.939, 16.302);
SetPlayerCameraLookAt(playerid, 2695.805, -1998.054, 13.547);
format(string, sizeof(string), "Los Aztecas");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_AZTECAS);
}
if(classid == teamVagos)
{
SetPlayerPos(playerid, 2697.3435, -1985.8120, -5.00);
SetPlayerCameraPos(playerid,1878.353,-2057.771,14.329);
SetPlayerCameraLookAt(playerid,1878.866,-2051.116,13.382);
format(string, sizeof(string), "Los Santos Vagos");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_VAGOS);
}
if(classid == teamNang)
{
SetPlayerPos(playerid, 2697.3435, -1985.8120, -5.00);
SetPlayerCameraPos(playerid,1613.528,-1784.622,14.131);
SetPlayerCameraLookAt(playerid,1614.588,-1787.776,13.471);
format(string, sizeof(string), "Da Nang Boys");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_NANG);
}
if(classid == teamRifa)
{
SetPlayerPos(playerid, 286.2257, -1796.2596, -5.00);
SetPlayerCameraPos(playerid,277.441,-1799.912,8.431);
SetPlayerCameraLookAt(playerid,286.225,-1796.259,4.390);
format(string, sizeof(string), "Los Santos Rifa");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_RIFA);
}
if(classid == teamBikers)
{
SetPlayerPos(playerid, 674.4105, -475.4872, -5.00);
SetPlayerCameraPos(playerid,663.823,-494.759,17.524);
SetPlayerCameraLookAt(playerid,667.020,-490.379,16.335);
format(string, sizeof(string), "Los Santos Bikies");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_BIKERS);
}
if(classid == teamRMafia)
{
SetPlayerPos(playerid, 1025.5427, -1138.2739, -5.00);
SetPlayerCameraPos(playerid, 1027.122, -1151.055, 27.167);
SetPlayerCameraLookAt(playerid,1025.542, -1138.273, 23.656);
format(string, sizeof(string), "Russian Mafia");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_RMAFIA);
}
/*if(classid == teamIMafia)
{
SetPlayerPos(playerid, 335.5112,-1588.2958,-5.00);
SetPlayerCameraPos(playerid,341.054,-1609.225,44.013);
SetPlayerCameraLookAt(playerid,335.511,-1588.295,33.101);
format(string, sizeof(string), "Italian Mafia");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_IMAFIA);
}*/
if(classid == teamPolice)
{
SetPlayerPos(playerid, 1509.8518,-1612.1667,-5.00);
SetPlayerCameraPos(playerid,1506.578,-1608.765,14.616);
SetPlayerCameraLookAt(playerid,1509.851,-1612.166,14.046);
format(string, sizeof(string), "Los Santos Police Department");
TextDrawSetString(classSelectionTextdraw1[playerid], string);
TextDrawColor(classSelectionTextdraw1[playerid], COLOR_POLICE);
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
gIsPlayerLoggedIn[playerid] = 0;
classSelectionTextdraw1[playerid] = TextDrawCreate(144.000000, 140.000000, "Grove Street Families");
TextDrawBackgroundColor(classSelectionTextdraw1[playerid], 255);
TextDrawFont(classSelectionTextdraw1[playerid], 0);
TextDrawLetterSize(classSelectionTextdraw1[playerid], 0.819999, 2.499999);
TextDrawColor(classSelectionTextdraw1[playerid], 16711935);
TextDrawSetOutline(classSelectionTextdraw1[playerid], 0);
TextDrawSetProportional(classSelectionTextdraw1[playerid], 1);
TextDrawSetShadow(classSelectionTextdraw1[playerid], 1);
classSelectionTextdraw2[playerid] = TextDrawCreate(149.000000, 225.000000, "Please choose your team carefully.");
TextDrawBackgroundColor(classSelectionTextdraw2[playerid], 255);
TextDrawFont(classSelectionTextdraw2[playerid], 1);
TextDrawLetterSize(classSelectionTextdraw2[playerid], 0.330000, 1.200000);
TextDrawColor(classSelectionTextdraw2[playerid], COLOR_LIGHTGREY);
TextDrawSetOutline(classSelectionTextdraw2[playerid], 0);
TextDrawSetProportional(classSelectionTextdraw2[playerid], 1);
TextDrawSetShadow(classSelectionTextdraw2[playerid], 1);
classSelectionTextdraw3[playerid] = TextDrawCreate(147.000000, 236.000000, "You can only change your team by registering a new account.");
TextDrawBackgroundColor(classSelectionTextdraw3[playerid], 255);
TextDrawFont(classSelectionTextdraw3[playerid], 1);
TextDrawLetterSize(classSelectionTextdraw3[playerid], 0.330000, 1.200000);
TextDrawColor(classSelectionTextdraw3[playerid], COLOR_LIGHTGREY);
TextDrawSetOutline(classSelectionTextdraw3[playerid], 0);
TextDrawSetProportional(classSelectionTextdraw3[playerid], 1);
TextDrawSetShadow(classSelectionTextdraw3[playerid], 1);
classSelectionTextdraw4[playerid] = TextDrawCreate(147.000000, 248.000000, "You can change your skin inside your teams headquarters.");
TextDrawBackgroundColor(classSelectionTextdraw4[playerid], 255);
TextDrawFont(classSelectionTextdraw4[playerid], 1);
TextDrawLetterSize(classSelectionTextdraw4[playerid], 0.330000, 1.200000);
TextDrawColor(classSelectionTextdraw4[playerid], COLOR_DARKGREY);
TextDrawSetOutline(classSelectionTextdraw4[playerid], 0);
TextDrawSetProportional(classSelectionTextdraw4[playerid], 1);
TextDrawSetShadow(classSelectionTextdraw4[playerid], 1);
classSelectionTextdraw5[playerid] = TextDrawCreate(500.000000, 225.000000, " ");
TextDrawBackgroundColor(classSelectionTextdraw5[playerid], 255);
TextDrawFont(classSelectionTextdraw5[playerid], 1);
TextDrawLetterSize(classSelectionTextdraw5[playerid], 0.500000, 1.000000);
TextDrawColor(classSelectionTextdraw5[playerid], -1);
TextDrawSetOutline(classSelectionTextdraw5[playerid], 0);
TextDrawSetProportional(classSelectionTextdraw5[playerid], 1);
TextDrawSetShadow(classSelectionTextdraw5[playerid], 1);
TextDrawUseBox(classSelectionTextdraw5[playerid], 1);
TextDrawBoxColor(classSelectionTextdraw5[playerid], 55);
TextDrawTextSize(classSelectionTextdraw5[playerid], 130.000000, 33.000000);
return 1;
}
Then if I go to the next class (ballas), it changes to the first class (grove), then if i go the next class (aztecas), it changes to the previous class (ballas). How ever, everything else in the class selection works, so if I'm looking at the grove class, it's got the correct camera position and text, if i'm looking at the ballas class it's got the correct camera position and text etc. the only thing that isn't correct is the text color? How weird