SA-MP Forums Archive
Small Bug in kSpeedo FS - 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: Small Bug in kSpeedo FS (/showthread.php?tid=415011)



Small Bug in kSpeedo FS - DLR - 11.02.2013

I'm using this FilterScript, which works great. The only problem is that if you die when inside a vehicle, or exit the vehicle in any way other than normal, it doesn't process the players state change, thus leaving the text permanently on the screen.

https://sampforum.blast.hk/showthread.php?tid=358810&page=2


Re: Small Bug in kSpeedo FS - DLR - 11.02.2013

Found a solution. Anybody using this FilterScript add this to it.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    //Hide all the text draws for the player
    TextDrawHideForPlayer(playerid, speedo1[playerid]);
    TextDrawHideForPlayer(playerid, speedo2[playerid]);
    TextDrawHideForPlayer(playerid, speedo3[playerid]);
    speedo_status[playerid] = 0;
    return 1;
}



Re: Small Bug in kSpeedo FS - DiGiTaL_AnGeL - 11.02.2013

Hide all the speedo's textdraws at OnPlayerDeath and other callbaks that causes the player to exit from the vehicle.


Re: Small Bug in kSpeedo FS - S0n1COwnsYou - 11.02.2013

As "DLR" Said,
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
//Hide all the text draws for the player
    
TextDrawHideForPlayer(playeridspeedo1[playerid]);
    
TextDrawHideForPlayer(playeridspeedo2[playerid]);
    
TextDrawHideForPlayer(playeridspeedo3[playerid]);
    
speedo_status[playerid] = 0;
    return 
1;

Also Use This OnPlayerStateChange,
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        
TextDrawShowForPlayer(playeridspeedo1[playerid]);
        
TextDrawShowForPlayer(playeridspeedo2[playerid]);
        
TextDrawShowForPlayer(playeridspeedo3[playerid]);
        
speedo_status[playerid] = 1;
    }
    if(
oldstate == PLAYER_STATE_DRIVER)
    {
        
TextDrawHideForPlayer(playeridspeedo1[playerid]);
        
TextDrawHideForPlayer(playeridspeedo2[playerid]);
        
TextDrawHideForPlayer(playeridspeedo3[playerid]);
        
speedo_status[playerid] = 0;
    }
    return 
1;




Re: Small Bug in kSpeedo FS - DLR - 11.02.2013

speedo_status[playerid] is something extra I added in, because I put a /speedo command into the FilterScript also.

By default passengers can see the speedo (Which I've changed in my version), so you'd have to add checks to things like player ejecting and being teleported.