[HELP] PlayerIntoVehicle!!!!!!!!! - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] PlayerIntoVehicle!!!!!!!!! (
/showthread.php?tid=96963)
[HELP] PlayerIntoVehicle!!!!!!!!! -
Smiths - 11.09.2009
I got this:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(IsPlayerInVehicle(playerid, 462))
{
if(newstate == 2)//checks if player entered as driver
{
if(GetPlayerMoney(playerid) >= 25) //25 = the money u want the car to cost.
{
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xFFFF00AA,"You just bought this car.");
}
else
SendClientMessage(playerid,0xFFFF00AA,"You don't have enought money for this car.");
RemovePlayerFromVehicle(playerid);
}
else
SendClientMessage(playerid,0xFFFF00AA,"You need to enter as driver to buy this car."); //change YOUR_COLOR to the colors you have got and that you want to use
RemovePlayerFromVehicle(playerid);
}
}
This is supposed to make you pay before you enter the car... But nothing happen! it do nothing..... why?
Is there an other way to make it work great?
sorry for my english!
Re: [HELP] PlayerIntoVehicle!!!!!!!!! -
Smiths - 11.09.2009
Bump! Please help! is there a reason why it do that?
Re: [HELP] PlayerIntoVehicle!!!!!!!!! -
Nadav - 11.09.2009
Quote:
Originally Posted by Smiths
I got this:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate) { if(IsPlayerInVehicle(playerid, 462)) { if(newstate == 2)//checks if player entered as driver { if(GetPlayerMoney(playerid) >= 25) //25 = the money u want the car to cost. { GivePlayerMoney(playerid,-25); SendClientMessage(playerid,0xFFFF00AA,"You just bought this car."); } else SendClientMessage(playerid,0xFFFF00AA,"You don't have enought money for this car."); RemovePlayerFromVehicle(playerid); } else SendClientMessage(playerid,0xFFFF00AA,"You need to enter as driver to buy this car."); //change YOUR_COLOR to the colors you have got and that you want to use RemovePlayerFromVehicle(playerid); } }
This is supposed to make you pay before you enter the car... But nothing happen! it do nothing..... why?
Is there an other way to make it work great?
sorry for my english!
|
replace if(IsPlayerInVehicle(playerid, 462))
to :
if(IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 462)
...