02.04.2014, 06:10
I've followed some tutorials since this is my first time doing selectable text draws. It doesn't seem like it's being called..
pawn Код:
new PlayerText:CitySel[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
new PlayerText:LVSpawn[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
new PlayerText:SFSpawn[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
public OnPlayerRequestClass(playerid, classid)
{
PlayerTextDrawShow(playerid, CitySel[playerid]);
PlayerTextDrawShow(playerid, LVSpawn[playerid]);
PlayerTextDrawShow(playerid, SFSpawn[playerid]);
return 1;
}
public OnPlayerConnect(playerid)
{
CitySel[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 142.000000, "City Selection");
PlayerTextDrawBackgroundColor(playerid, CitySel[playerid], 255);
PlayerTextDrawFont(playerid, CitySel[playerid], 2);
PlayerTextDrawLetterSize(playerid, CitySel[playerid], 0.360000, 1.000000);
PlayerTextDrawColor(playerid, CitySel[playerid], -1);
PlayerTextDrawSetOutline(playerid, CitySel[playerid], 0);
PlayerTextDrawSetProportional(playerid, CitySel[playerid], 1);
PlayerTextDrawSetShadow(playerid, CitySel[playerid], 0);
PlayerTextDrawUseBox(playerid, CitySel[playerid], 1);
PlayerTextDrawBoxColor(playerid, CitySel[playerid], 701391103);
PlayerTextDrawTextSize(playerid, CitySel[playerid], 136.000000, 0.000000);
LVSpawn[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 159.000000, "Las Venturas");
PlayerTextDrawBackgroundColor(playerid, LVSpawn[playerid], 701391103);
PlayerTextDrawFont(playerid, LVSpawn[playerid], 2);
PlayerTextDrawLetterSize(playerid, LVSpawn[playerid], 0.370000, 1.000000);
PlayerTextDrawColor(playerid, LVSpawn[playerid], -1);
PlayerTextDrawSetOutline(playerid, LVSpawn[playerid], 0);
PlayerTextDrawSetProportional(playerid, LVSpawn[playerid], 1);
PlayerTextDrawSetShadow(playerid, LVSpawn[playerid], 1);
PlayerTextDrawUseBox(playerid, LVSpawn[playerid], 1);
PlayerTextDrawBoxColor(playerid, LVSpawn[playerid], 1357672959);
PlayerTextDrawTextSize(playerid, LVSpawn[playerid], 136.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, LVSpawn[playerid], true);
SFSpawn[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 173.000000, "San Fierro");
PlayerTextDrawBackgroundColor(playerid, SFSpawn[playerid], 701391103);
PlayerTextDrawFont(playerid, SFSpawn[playerid], 2);
PlayerTextDrawLetterSize(playerid, SFSpawn[playerid], 0.370000, 1.000000);
PlayerTextDrawColor(playerid, SFSpawn[playerid], -1);
PlayerTextDrawSetOutline(playerid, SFSpawn[playerid], 0);
PlayerTextDrawSetProportional(playerid, SFSpawn[playerid], 1);
PlayerTextDrawSetShadow(playerid, SFSpawn[playerid], 1);
PlayerTextDrawUseBox(playerid, SFSpawn[playerid], 1);
PlayerTextDrawBoxColor(playerid, SFSpawn[playerid], 1357672959);
PlayerTextDrawTextSize(playerid, SFSpawn[playerid], 136.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, SFSpawn[playerid], true);
return 1;
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(playertextid == LVSpawn[playerid])
{
SendClientMessage(playerid, COLOR_RED, "You selected LV!");
printf("Selectd LV");
}
else if(playertextid == SFSpawn[playerid])
{
SendClientMessage(playerid, COLOR_RED, "You selected SF");
printf("Selectd SF");
}
return 1;
}