Help with making a /park command
#1

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

Get the player coords, Save them to the ini file
Reply
#3


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

GetPlayerPos
format

very helpful
Reply
#5

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)