SA-MP Forums Archive
Removing Player From 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: Removing Player From Vehicle (/showthread.php?tid=560402)



Removing Player From Vehicle - Arxalan - 28.01.2015

Hello , i have a bug in my Gamemode but i don't know how to fix it . I tried many of Car Owner Ship Fs . But they are bugged due to a bug in my Gamemode . The Bug is that when player enters into a vehicle and try to buy it or Don't buy the the script remove the player from vehicle but he again enters into the vehicle automatically (i mean without the animation of entering into car) . Following is my code of Buying Vehicle (when player successfully buy a vehicle).
PHP код:
                    GivePlayerMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
                    
format(stringsizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp."GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
                    
SendClientMessage(playeridYELLOWstring);
                    
RemovePlayerFromVehicle(playerid);
                    
TogglePlayerControllable(playerid1);
                    return 
1;
                } 



Re: Removing Player From Vehicle - GentleMan - 28.01.2015

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
Hello , i have a bug in my Gamemode but i don't know how to fix it . I tried many of Car Owner Ship Fs . But they are bugged due to a bug in my Gamemode . The Bug is that when player enters into a vehicle and try to buy it or Don't buy the the script remove the player from vehicle but he again enters into the vehicle automatically (i mean without the animation of entering into car) . Following is my code of Buying Vehicle (when player successfully buy a vehicle).
PHP код:
                    GivePlayerMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
                    
format(stringsizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp."GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
                    
SendClientMessage(playeridYELLOWstring);
                    
RemovePlayerFromVehicle(playerid);
                    
TogglePlayerControllable(playerid1);
                    return 
1;
                } 
After the related player has bought the car , why you want to remove him from car ? why are you using RemovePlayerFromVehicle(playerid) ?

try removing that line


Re: Removing Player From Vehicle - ATGOggy - 28.01.2015

Where did you put the code?

OnPlayerEnterVehicle?


Re: Removing Player From Vehicle - TheRaGeLord - 28.01.2015

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
Hello , i have a bug in my Gamemode but i don't know how to fix it . I tried many of Car Owner Ship Fs . But they are bugged due to a bug in my Gamemode . The Bug is that when player enters into a vehicle and try to buy it or Don't buy the the script remove the player from vehicle but he again enters into the vehicle automatically (i mean without the animation of entering into car) . Following is my code of Buying Vehicle (when player successfully buy a vehicle).
PHP код:
                    
                    SendClientMessage
(playeridYELLOWstring);
                    ------------->>>>>>
RemovePlayerFromVehicle(playerid);
                    
TogglePlayerControllable(playerid1);
                    return 
1;
                } 
Remove This Line


Re: Removing Player From Vehicle - Arxalan - 28.01.2015

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Where did you put the code?

OnPlayerEnterVehicle?
OnDialogResponse.when he enter into a vehicle A Dialog appears and he can choose he wanna to buy it or not


Re: Removing Player From Vehicle - TheRaGeLord - 28.01.2015

and Replace RemovePlayerFromVehicle(playerid) By ClearPlayerAnimation(playerid) in your codes


Re: Removing Player From Vehicle - ATGOggy - 28.01.2015

Try this:
PHP код:
                   GivePlayerMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]); 
                    
format(stringsizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp."GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]); 
                    
SendClientMessage(playeridYELLOWstring); 
                    new 
Float:xFloat:yFloat:z;
                    
GetPlayerPos(playerid,x,y,z);
                    
SetPlayerPos(playerid,x,y,z);
                    return 
1
                } 



Re: Removing Player From Vehicle - Arxalan - 28.01.2015

Same bug . Now player get out of vehicle and enters into it directly (without animation).


Re: Removing Player From Vehicle - ATGOggy - 28.01.2015

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
Same bug . Now player get out of vehicle and enters into it directly (without animation).
Tried mine?


Re: Removing Player From Vehicle - Arxalan - 29.01.2015

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Tried mine?
Yes yours.