Help with a /park command
#1

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.
Reply
#2

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
Reply
#3

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?
Reply
#4

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
Reply
#5

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?
Reply
#6

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.
Reply
#7

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

You didn't define "vehicleid"

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


Forum Jump:


Users browsing this thread: 2 Guest(s)