new PlayerText:PoliceO[MAX_PLAYERS];
PlayerTextDrawHide(playerid, PoliceO[playerid]);
PoliceO[playerid] = CreatePlayerTextDraw(playerid,232.000000, 156.000000, "~b~~h~~h~~h~Police Officer ~w~~h~Job~b~~h~!");
PlayerTextDrawBackgroundColor(playerid,PoliceO[playerid], 255);
PlayerTextDrawFont(playerid,PoliceO[playerid], 3);
PlayerTextDrawLetterSize(playerid,PoliceO[playerid], 0.500000, 1.600000);
PlayerTextDrawColor(playerid,PoliceO[playerid], -1);
PlayerTextDrawSetOutline(playerid,PoliceO[playerid], 1);
PlayerTextDrawSetProportional(playerid,PoliceO[playerid], 1);
PlayerTextDrawSetSelectable(playerid,PoliceO[playerid], 0);
If I figured out your problem the good way, a textdraw shows when a player enters a vehicle and you want to hide it ?
Under OnPlayerEnterVehicle, simply add your "PlayerTextDrawHide". When a player enters a vehicle, he doesn't spawn. And it's the same when he exits. |
Can you show us your OnPlayerStateChange and your OnPlayerEnterVehicle callback please ?
Because OnPlayerStateChange is called after OnPlayerEnterVehicle, if the textdraw is shown back in this callback, it's normal that you still show it. |
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
AccountInfo[playerid][pLastVehicle] = 1;
TextDrawHideForPlayer(playerid, PoliceO[playerid]);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new oname[MAX_PLAYER_NAME];
GetPlayerName(playerid, oname, sizeof oname);
if(newstate == PLAYER_STATE_DRIVER)
{
if (IsArmyVehicle(GetPlayerVehicleID(playerid))) {
if(gTeam[playerid] !=Team_Army)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "You are not an Army official. You cannot drive/fly an army vehicle.");
return 1;
}
}
if(GetPlayerVehicleID(playerid) == House4Car1 || GetPlayerVehicleID(playerid) == House4Car2)
{
if(!strcmp(House_Four_Owner, oname, true))
{
SendClientMessage(playerid, COLOR_GREY, "Welcome to your vehicle!");
}
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This isn't your vehicle. You cannot drive it.");
return 1;
}
}
if(GetPlayerVehicleID(playerid) == House7Car1)
{
if(!strcmp(House_Seven_Owner, oname, true))
{
SendClientMessage(playerid, COLOR_GREY, "Welcome to your vehicle!");
}
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This isn't your vehicle. You cannot drive it.");
return 1;
}
}
if(GetPlayerVehicleID(playerid) == House6Car1)
{
if(strcmp(House_Six_Owner, oname,true))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This isn't your vehicle. You cannot drive it.");
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "Welcome to your vehicle!");
}
if (IsLSPDVehicle(GetPlayerVehicleID(playerid))) {
if(gTeam[playerid] != Team_Cop && gTeam[playerid] != Team_Cop && gTeam[playerid] != Team_FBI && gTeam[playerid] != Team_Guard)
{
new string[120];
format(string, 120, "[CAR THEFT] %s has stolen a police vehicle.", PlayerInfo(playerid));
SendCopMessage(string);
format(string, 120, "Type /radiooff to turn off your police radio.");
SendCopMessage(string);
IncreaseWantedLevel(playerid, 4);
}
}
if(GetPlayerVehicleID(playerid) == AdminCar1 || GetPlayerVehicleID(playerid) == AdminCar2)
{
if(AccountInfo[playerid][pAdminLevel] == 0)
{
SendClientMessage(playerid, COLOR_ADMIN, "You cannot drive the Admin Vehicle.");
RemovePlayerFromVehicle(playerid);
return 1;
}
SendClientMessage(playerid, COLOR_ADMIN, "Welcome to your Admin Only Vehicle!");
}
}
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
ShowPlayerSpeedo(playerid);
AccountInfo[playerid][pLastVehicle] = GetPlayerVehicleID(playerid);
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_LIME, "You have enter a vehicle do /vhelp for vehicle commands.");
}
return 1;
}