SA-MP Forums Archive
Need help with car shop system. - 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: Need help with car shop system. (/showthread.php?tid=398064)



Need help with car shop system. - 101 - 08.12.2012

Hey guys I need help with this.
Basically I have a /buycar CMD. It works as following: User gets in a car, does /buycar and the command executes.
Command code:

Код:
if(IsPlayerInVehicle(playerid, moonbeam))
{
	if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid,COLOR_RED,"Missing money");
  	new buymoonbeam;
	GivePlayerMoney(playerid, -1000);
  	buymoonbeam = CreateVehicle( 418, 1705.3927,-1052.3236,23.7379,90.0873,-1,-1,-1);
	PutPlayerInVehicle( playerid, buymoonbeam, 0);
	DestroyVehicle(moonbeam);
	moonbeam = CreateVehicle(418,1621.09997559,-1107.40002441,24.10000038,90.00000000,-1,-1,15); //Moonbeam 8k
}
"moonbeam" is the old vehicle that the user has to be in to buy it, that part works (it destroys it to avoid having the player bugged - ghost car bug then recreates it) - this part works

buymoonbeam is the ID of the new vehicle that gets created.

basically, when the car the user bought gets destroyed it respawns to its original spawn which is bad (because its a car shop market, it would get massively clogged up)

I need to make it so the car won't go bac tk ots original location when destroy, to either be deleted or something similiar. I tried DestroyVehicle(buymoonbeam); it works BUT if I spawn two, it only works for the last spawned one.

So can anyone help?

EDIT: Theoretically is this a valid solution?

buymoonbeam = CreateVehicle( 418, 0,0,0,0,-1,-1,-1);
SetVehiclePos(buymoonbeam, 1705.3927,-1052.3236,23.7379);


Re: Need help with car shop system. - RajatPawar - 08.12.2012

I still didn't understand this, how are you destroying and creating 'moonbeam'? You wan't it not to respawn, Destroy it? Or am I wrong in understanding the question itself?


Re: Need help with car shop system. - 101 - 08.12.2012

You're wrong. As I said the moonbeam is okay, the problem is the buymoonbeam. After it gets destroyed it respawns, I want it not to.