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



Help with making a /park command - Ed2ka49 - 16.02.2009

Allright, I got a file called "Cars.ini" in my Scriptfile, that after I add a vehicle in the game is saves it in the file.
Line for exanple: "{My_Name::560:1:1:-1616.887329:711.044311:48.937500:258.387298}"

My question;
How to make a /park command that ill get my X Y Z O position in the car, and will change the line in the Ini file?

Someone can help me please?

Thank you.


Re: Help with making a /park command - MenaceX^ - 16.02.2009

Get the player coords, Save them to the ini file


Re: Help with making a /park command - Ed2ka49 - 16.02.2009


I thought about that alone, but I got a little problem.. emm, I don't know how to do that =[


Re: Help with making a /park command - Daren_Jacobson - 16.02.2009

GetPlayerPos
format

very helpful


Re: Help with making a /park command - Ed2ka49 - 16.02.2009

Man can you explain it for me please?
I'm not so good in scripting =[


Re: Help with making a /park command - Joe Staff - 16.02.2009

Is there a way to edit a single line in a file? That is, without having to copy everything down and then re-write the whole file with a single edited line.
Use https://sampwiki.blast.hk/ and look up format, GetPlayerPos, and fwrite


Re: Help with making a /park command - Daren_Jacobson - 16.02.2009

kabamm
pawn Код:
new pName[MAX_PLAYER_NAME], Float:x, Float:y, Float:z, Float:angle, model, color1, color2, vid, string[256]; //256 only because this is long.
vid = GetPlayerVehicleID(playerid);
model = GetVehicleModel(vid);
GetPlayerName(playerid, pName, sizeof(pName))
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, angle);
//you can't get vehicle colors so, i will just set those to -1
format(string, sizeof(string), "{%s::%i:-1:-1:%f:%f:%f:%f}", pName, model, x, y, z, angle);
there is the string, do what you want with it


Re: Help with making a /park command - Joe Staff - 16.02.2009

Great we were spoon fed, but he's asking about replacing a line...

That's like asking for meatballs and marinara and instead they just spit in your sandwich

a bit harsh but it was funny


Re: Help with making a /park command - Ed2ka49 - 17.02.2009

There is any way to REPLACE a line in the file?


Re: Help with making a /park command - Daren_Jacobson - 18.02.2009

sorry, i misunderstood what you wanted
https://sampwiki.blast.hk/wiki/YSI:INI
that is all i can do for you, read it all or you will be in some deep doodoo.