SA-MP Forums Archive
Help with a /park command - 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 with a /park command (/showthread.php?tid=64097)



Help with a /park command - ihatetn931 - 02.02.2009

Well i'm making a car ownership for my gamemode that i'm creating I can't get /park to work just right, I want it so when you type /park the car will respawn there after it blows ect. I don't wanna have to disconnect nor do a gmx to get it to save, I want it to save that spot as soon as i do /park How could i do this? As of no my cars are saved to a file.


Re: Help with a /park command - ICECOLDKILLAK8 - 02.02.2009

Unless the positions are saved to a file then you cant, If you want it so it stays in that position just for this Session then you could Destroy the vehicle then create a new one in the new place, But if you did it that way it would go back to the old position after a server restart


Re: Help with a /park command - ihatetn931 - 02.02.2009

the orginal spawn points are saved in a file, possibly, I'm somewhat new at scirpting, Is there a way to type /park and it writes it to the file? right when you type it so if you blow your car it will spawn at that spot?


Re: Help with a /park command - ICECOLDKILLAK8 - 02.02.2009

Quote:
Originally Posted by ihatetn931
the orginal spawn points are saved in a file, possibly, I'm somewhat new at scirpting, Is there a way to type /park and it writes it to the file? right when you type it so if you blow your car it will spawn at that spot?
I would suggest writing it to a file, Then when you do /park it destroys the vehicle then re creates it


Re: Help with a /park command - ihatetn931 - 02.02.2009

Quote:
Originally Posted by JeNkStAX
Quote:
Originally Posted by ihatetn931
the orginal spawn points are saved in a file, possibly, I'm somewhat new at scirpting, Is there a way to type /park and it writes it to the file? right when you type it so if you blow your car it will spawn at that spot?
I would suggest writing it to a file, Then when you do /park it destroys the vehicle then re creates it
How would i go about doing that? Mine givin me some pointers or somthin?


Re: Help with a /park command - ihatetn931 - 02.02.2009

Ok, this is what i got, I copied it from onplayerdisconnect, I got the command and everything right i belive

Код:
	if(strcmp(cmd,"/park",true)==0)
		if(IsPlayerConnected(playerid))
	{
	  for(new i = 0; i < sizeof(CarInfo); i++)
	  {
		  if(vehicleid == CarInfo[i][ownedvehicle])
		  	{
		  	new Float:x,Float:y,Float:z;
				new Float:a;
				GetVehiclePos(vehicleid, x, y, z);
				GetVehicleZAngle(vehicleid, a);
				CarInfo[i][cLocationx] = x;
				CarInfo[i][cLocationy] = y;
				CarInfo[i][cLocationz] = z;
				CarInfo[i][cAngle] = a;
				SendClientMessage(playerid, COLOR_GREEN, "Your car will now spawn in this spot");
				return 1;
			}
		}
	}
My errors, I can't find the define in the scirpt for vehicleid, I've looked all over, I've tried it with another devinf vehid, but when i type /park in game and blow the car, Nothing happens. It just goes to it's orginal spawn spot

C:\Users\Desktop\server\filterscripts\[FS]CarOwnership.pwn(186) : error 017: undefined symbol "vehicleid"
C:\Users\Desktop\server\filterscripts\[FS]CarOwnership.pwn(190) : error 017: undefined symbol "vehicleid"
C:\Users\Desktop\server\filterscripts\[FS]CarOwnership.pwn(191) : error 017: undefined symbol "vehicleid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: Help with a /park command - ICECOLDKILLAK8 - 02.02.2009

You need to find a way to save the file too, ATM it will reset after the server restarts


Re: Help with a /park command - raqa619 - 12.05.2009

You didn't define "vehicleid"

Add something like:
Код:
new vehicleid = GetPlayerVehicleID;