Car system problems - 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: Car system problems (
/showthread.php?tid=87757)
Car system problems -
coole210 - 22.07.2009
NOT SOLVED STILL. When i enter vehicles it ALWAYS says [ ! ] ID : 0 ' Turismo ' Bought by: Coole210 even if i enter second car !!
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
if(Cars[GetPlayerVehicleID(playerid)][cOwner] == 1)
{
format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Bought by : %s",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cOwner]);
SendClientMessage(playerid,COLOR_GREY,string);
}
if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 0)
{
format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Price : %d RCASH",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cPrice]);
SendClientMessage(playerid,COLOR_GREY,string);
}
if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 1)
{
format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Bought by : %s",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cOwner]);
SendClientMessage(playerid,COLOR_GREY,string);
}
return 1;
}
Re: Car system BIG PROBLEM ! -
yezizhu - 22.07.2009
Код:
[quote]
Okay my car system works fine with 1 car but when i add second car i enter car and it says BOTH cars ! Car ID : 1 Infernus and Car ID : 0 Turismo and when i try to buy the second car ( ID 1 ) it buys the first 1 !!
OnPlayerStateChange&OnPlayerEnterVehicle
Re: Car system BIG PROBLEM ! -
coole210 - 22.07.2009
Thats just going to change messages if i fix that and ALSO, you didnt tell me how to change that :S
Re: Car system BIG PROBLEM ! -
yezizhu - 22.07.2009
Sorry for my lazy.
I cannot find any problem from your code, so I need more code(StateChange&EnterVehicle)
Re: Car system BIG PROBLEM ! -
coole210 - 22.07.2009
[SOLVED]
Re: Car system BIG PROBLEM ! -
RyDeR` - 22.07.2009
Deleted sory
![Cheesy](images/smilies/biggrin.png)
I didn't see the code lol
Re: Car system BIG PROBLEM ! -
coole210 - 22.07.2009
[SOLVED]
Re: Car system BIG PROBLEM ! -
coole210 - 22.07.2009
[SOLVED]
Re: Car system BIG PROBLEM ! -
coole210 - 22.07.2009
[SOLVED]
Re: Car system BIG PROBLEM ! -
Joe Staff - 22.07.2009
Why is there a 'while' statement in that code? (the /buy command)
If you're trying to determine if the car that the player is in is owned, then you should use GetPlayerVehicleID(playerid)-1 (-1 because there is no vehicle ID 0)