SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 09/03/2018, 05:44 AM   #1
KayJ
Gangsta
 
Join Date: Apr 2014
Posts: 698
Reputation: 61
Flowers Position - Save, Load & Delete [Y_INI][ZCMD]

Position - Save, Load & Delete [Y_INI][ZCMD]
(With 1 command)

About:
It's a simple script which saves, loads & delete your position with 1 command and also if you want you can set player position on spawn(toggle able in script). I just released this separately(it means I took a part from my whole script) as people liked it and asked me to release it. It saves your location in the file and loads it, just similar to /savepos, /loadpos.

Command:
Code:
/mypos <save/load/delete>
Saving:
  • Xpos
  • Ypos
  • Zpos
  • Angle
  • Interior
  • Virtual World

Download:
Position - Save, Load & Delete[Y_INI].zip | position.pwn | position.amx
position.pwn: Pastebin | RAW
sscanf | YSI 4.0.2 ~ Y_Less
ZCMD ~ Zeex

Last edited by KayJ; 11/03/2018 at 09:16 AM. Reason: Title Fixed!
KayJ is offline   Reply With Quote
Old 09/03/2018, 05:54 AM   #2
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,142
Reputation: 344
Default Re: Position - Save, Load & Delete[Y_INI][ZCMD]

Oh so its basically a TP-TO command, okay and it only saves one position?

Welp that's okay

I've viewed your code but i have some things that would help you further on (my opinion on this),

What's the point of saving/loading at OnFilterScriptExit/Init? And at OnPlayerDisconnect??

Also i'd suggest you use this form of a loop:
PHP Code:
for(new iGetPlayerPoolSize(); <= ji++) 
And it says /*INCLUDES AND COLORS*/ but i see no colors lol (its nothing but maybe you forgot to use the colors?)

Also you used if(pos == 0) { around 3 times, it wont affect much but it'd be better to know using switch on long statements is better than using the if/else ladder.

And do you really have to do your brackets this way? i think it'd be better if you follow the original method it's way better finding opening/closing brackets and for better readability (in my honest opinion).

Btw why is the new string[128] using a big array? the player's name wont go past around 26 and the path file name isn't even 20 so that's totally unused, a smaller array would've worked fine, you could've even used one variable at that case.

I also don't think the way you handle null positions is working, what if i try to load position before i save at all? what if i delete and then load? wouldn't that send me straight to the countryside (0.0 coords) ?

And did you mess an 'else' here? lines 96..97
PHP Code:
            SendClientMessage(playerid, -1"SUCCESS: Position is deleted! Use /mypos 1 to save."); }
        
SendClientMessage(playerid, -1"ERROR: You didn't save any Position. Use /mypos 1 to save."); } 
Because this will send both messages.
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 09/03/2018, 06:06 AM   #3
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,142
Reputation: 344
Default Re: Position - Save, Load & Delete[Y_INI][ZCMD]

Quote:
Originally Posted by KayJ View Post
I used them because it's a filterscript if you unload it, then it will save the data instead of calling OnPlayerDisconnect(which results server kick).
I used those brackets that way to optimize the code though.
I'll fix rest of those and add some of your suggestions.
No no you don't get what i'm saying,

I mean, the only way to save/load positions on your FS is through the mypos command, so why save data at disconnect,filterscriptinit/exit?

You don't need any of that at all no? maybe i got it wrong but that's how it seems.

Quote:
Originally Posted by KayJ
I used those brackets that way to optimize the code though.
How's that an optimization?
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 09/03/2018, 06:13 AM   #4
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,142
Reputation: 344
Default Re: Position - Save, Load & Delete[Y_INI][ZCMD]

Quote:
Originally Posted by KayJ View Post
I just added them for double surety if any crash happens, although I know it's useless to add there.
Crash won't even matter mate, you only save/load through the cmd, so yes it's completely useless, also using brackets in that way affects nothing but bad readability, the brackets formation only affect the code's readability.
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 09/03/2018, 11:34 AM   #5
Mkssid
Little Clucker
 
Join Date: May 2013
Posts: 5
Reputation: 1
Default Re: Position - Save, Load & Delete[Y_INI][ZCMD]

Nice work.
Mkssid is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Save, load and set player position - using y_ini SmiT Tutorials 32 26/07/2018 11:38 AM
[FilterScript] Position System | Load / Save / Overwrite | Yini - ZCMD Excel™ Filterscripts 24 03/01/2014 06:38 PM
I need help! pls! /s and /r or /l script or fs save position and load position ProdrifterX Scripting Help 2 14/10/2011 04:02 PM


All times are GMT. The time now is 02:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.