SA-MP Forums Archive
Textdraw show when enter vehicle? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Textdraw show when enter vehicle? (/showthread.php?tid=528173)



Textdraw show when enter vehicle? - UserName31 - 26.07.2014

i dont know i did playertextdraw rite but still keep showing on playerenter vehicle i tryed to hide it but wont work

PHP код:
new PlayerText:PoliceO[MAX_PLAYERS]; 
onplayerspawn
PHP код:
PlayerTextDrawHide(playeridPoliceO[playerid]); 
onaplayerConnect
PHP код:
    PoliceO[playerid] = CreatePlayerTextDraw(playerid,232.000000156.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.5000001.600000);
    
PlayerTextDrawColor(playerid,PoliceO[playerid], -1);
    
PlayerTextDrawSetOutline(playerid,PoliceO[playerid], 1);
    
PlayerTextDrawSetProportional(playerid,PoliceO[playerid], 1);
    
PlayerTextDrawSetSelectable(playerid,PoliceO[playerid], 0); 



Re : Textdraw show when enter vehicle? - S4t3K - 26.07.2014

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.


Re: Re : Textdraw show when enter vehicle? - UserName31 - 26.07.2014

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
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.
i did that it dont work


Re : Textdraw show when enter vehicle? - S4t3K - 26.07.2014

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.


Re: Re : Textdraw show when enter vehicle? - UserName31 - 27.07.2014

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
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.
onplayerenter vehicle
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
AccountInfo[playerid][pLastVehicle] = 1;
     
TextDrawHideForPlayer(playeridPoliceO[playerid]);
    return 
1;

onplayerchangeupdate
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
oname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridonamesizeof oname);
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if (
IsArmyVehicle(GetPlayerVehicleID(playerid))) {
            if(
gTeam[playerid] !=Team_Army)
            {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_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_Owneronametrue))
            {
                
SendClientMessage(playeridCOLOR_GREY"Welcome to your vehicle!");
            }
            else {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_RED"This isn't your vehicle. You cannot drive it.");
                return 
1;
            }
        }
        if(
GetPlayerVehicleID(playerid) == House7Car1)
        {
            if(!
strcmp(House_Seven_Owneronametrue))
            {
                
SendClientMessage(playeridCOLOR_GREY"Welcome to your vehicle!");
            }
            else {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_RED"This isn't your vehicle. You cannot drive it.");
                return 
1;
            }
        }
        if(
GetPlayerVehicleID(playerid) == House6Car1)
        {
            if(
strcmp(House_Six_Owneroname,true))
            {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_RED"This isn't your vehicle. You cannot drive it.");
                return 
1;
            }
            
SendClientMessage(playeridCOLOR_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(string120"[CAR THEFT] %s has stolen a police vehicle."PlayerInfo(playerid));
                
SendCopMessage(string);
                
format(string120"Type /radiooff to turn off your police radio.");
                
SendCopMessage(string);
                
IncreaseWantedLevel(playerid4);
            }
        }
        if(
GetPlayerVehicleID(playerid) == AdminCar1 || GetPlayerVehicleID(playerid) == AdminCar2)
        {
            if(
AccountInfo[playerid][pAdminLevel] == 0)
            {
                
SendClientMessage(playeridCOLOR_ADMIN"You cannot drive the Admin Vehicle.");
                
RemovePlayerFromVehicle(playerid);
                return 
1;
            }
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_LIME"You have enter a vehicle do /vhelp for vehicle commands.");
    }
    return 
1;