[FilterScript] Dennis12's Attachments Object Editor
#1

Dennis12\'s Attachments Object Editor


Introduction

Hello everyone, these days we are looking for such a filtercript, but I did not find one, and that one did not like it. So I thought I\'d create my own filterscript to finish my job, and now I want to share it with you.

Preview

Here you can see a small presentation of the filterscript.

I would appreciate if you let a like + comm clip

https://www.youtube.com/watch?v=AbTk...ature=*********

Commands
  • /attach -> To attach an object to one of the 9 slots.
  • /editattach -> To edit an attached object.
  • /clearattach -> To delete the object on one of the 9 slots.
  • /saveattach -> To save your progress into [scriptfiles/attach.pwn].
  • /clearfile -> To delete the contents of the attach.pwn file.
Bugs

At the moment we did not find any bugs, but if you find one, you can write it down and it will be solved in the next version.

Credits
  • Dennis12 - Codding
  • Zeex - ZCMD
DOWNLOAD

https://www102.zippyshare.com/v/TP2Wu6XS/file.html
https://pastebin.com/DuPGGfQJ


If i helped you, use +rep
Reply
#2

I will use, my friend...
Thank you for sharing!
Reply
#3

Pastebin/github?
Reply
#4

Quote:
Originally Posted by Koplan
View Post
I will use, my friend...

Thank you for sharing!
No problem

Quote:
Originally Posted by RogueDrifter
View Post
Pastebin/github?
https://pastebin.com/WuCBuf5F
Reply
#5

PHP Code:
/*
    Script Version: v1
    This FilterScript was created by Dennis12
    LEAKS.RO  -> leaks.ro/profile/411-dennis12/
    SA-MP.RO  -> www.sa-mp.ro/profile/20571-dennis12/
    SA-MP.COM -> forum.sa-mp.com/member.php?u=305443
*/ 
Leaks?


Also this doesn\'t make any sense:
PHP Code:
public OnFilterScriptInit()
{
    for(new 
050xi++) SendClientMessageToAll(-1,""); 
Also why do you people use these useless meaningless macros?
PHP Code:
#define D12_MESSAGE SendClientMessage 
And why are you forcing player position at spawn anyway?
PHP Code:
public OnPlayerSpawn(playerid) {
    
SetPlayerPos(playerid112.6015,-162.6049,1.5781); 
I believe these should\'ve been on top of the script
PHP Code:
// Enums
enum D12_ATTACHED_OBJECT {
    
objectID,
    
objectSlot,
    
objectBone,
    
FloatobjectPos[3],
    
FloatobjectRot[3],
    
FloatobjectScale[3]
};
new 
D12_AO[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][D12_ATTACHED_OBJECT];
 
enum D_EDITOBJECTD_CLEARSLOTD_EDITSLOT }; 
Not big of a deal since you haven\'t used them before but you should keep them on top always to avoid usage before declaration.

And why not use a more advanced file saving system?

Also this didn\'t need 1024 cells:
PHP Code:
new dialog[1024]; 
Also for best practice its always better to use sizeof(string) instead of the actual size of the string for compatibility issues in case if the size of that string actually changes one time so you wouldn\'t get \'Array index out of bounds\' messages.
PHP Code:
format(string64"You are now editing attached object in the slot %d."listitem); 
I\'m gonna give this 2 stars it could\'ve been done better good luck improving.
Reply
#6

Quote:
Originally Posted by RogueDrifter
View Post
Also for best practice its always better to use sizeof(string) instead of the actual size of the string for compatibility issues in case if the size of that string actually changes one time so you wouldn\'t get \'Array index out of bounds\' messages.
PHP Code:
format(string64"You are now editing attached object in the slot %d."listitem); 
This won\'t give an "Array index out of bounds" message but it will do a buffer overflow if the size of string-variable is less than the characters.
Reply
#7

Quote:
Originally Posted by RogueDrifter
View Post
[PHP]


Also this doesn\'t make any sense:
PHP Code:
public OnFilterScriptInit()
{
    for(new 
050xi++) SendClientMessageToAll(-1,""); 


... ... ...
To add on to this:



PHP Code:
public OnFilterScriptInit()
{
    for(new 
050xi++) SendClientMessageToAll(-1,""); 
Even though that snippet is the most useless thing I\'ve ever seen: to properly clear off the, you only need to send 20 blank client messages as (/pagesize) is cut out from 10 to 20, and since x is a constant integer, you don\'t need to create a second hand variable. and third: don\'t name your variables by a single character, just write the whole word, in this case I\'d call it an index.

PHP Code:
public OnFilterScriptInit()
{
    for(new 
index 0index 20index ++)
        
SendClientMessageToAll(-1""); 
Reply
#8

Quote:
Originally Posted by coool
View Post
This won\'t give an "Array index out of bounds" message but it will do a buffer overflow if the size of string-variable is less than the characters.
Nevertheless the point is pretty similar adding a higher value than the actual array size which will overwrite info beyond the buffer.
Reply
#9

Quote:
Originally Posted by RogueDrifter
View Post
PHP Code:
/*
    Script Version: v1
    This FilterScript was created by Dennis12
    LEAKS.RO  -> leaks.ro/profile/411-dennis12/
    SA-MP.RO  -> www.sa-mp.ro/profile/20571-dennis12/
    SA-MP.COM -> forum.sa-mp.com/member.php?u=305443
*/ 
Leaks?



Also this doesn\'t make any sense:
PHP Code:
public OnFilterScriptInit()
{
    for(new 
050xi++) SendClientMessageToAll(-1,""); 
Also why do you people use these useless meaningless macros?
PHP Code:
#define D12_MESSAGE SendClientMessage 
And why are you forcing player position at spawn anyway?
PHP Code:
public OnPlayerSpawn(playerid) {
    
SetPlayerPos(playerid112.6015,-162.6049,1.5781); 
I believe these should\'ve been on top of the script
PHP Code:
// Enums
enum D12_ATTACHED_OBJECT {
    
objectID,
    
objectSlot,
    
objectBone,
    
FloatobjectPos[3],
    
FloatobjectRot[3],
    
FloatobjectScale[3]
};
new 
D12_AO[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][D12_ATTACHED_OBJECT];
 
enum D_EDITOBJECTD_CLEARSLOTD_EDITSLOT }; 
Not big of a deal since you haven\'t used them before but you should keep them on top always to avoid usage before declaration.


And why not use a more advanced file saving system?


Also this didn\'t need 1024 cells:
PHP Code:
new dialog[1024]; 
Also for best practice its always better to use sizeof(string) instead of the actual size of the string for compatibility issues in case if the size of that string actually changes one time so you wouldn\'t get \'Array index out of bounds\' messages.
PHP Code:
format(string64"You are now editing attached object in the slot %d."listitem); 
I\'m gonna give this 2 stars it could\'ve been done better good luck improving.
It\'s only a filterscript .. yea, i made a few mistakes by code, but I also mentioned that I did not give too much effort, because it is just an FS you use occasionally, do not implement it on gamemodes or something.


leaks is a romanian site dedicated to SA-MP, but also programming in other languages.


Yea, ik,i didn\'t not need it 1024 cells for dialog, i put it for test and i forget to change.


I made a few changes to the code just for your pleasure

I hope you like it. I updated in the post.
Reply
#10

Quote:
Originally Posted by Dennis12
View Post
It\'s only a filterscript .. yea, i made a few mistakes by code, but I also mentioned that I did not give too much effort, because it is just an FS you use occasionally, do not implement it on gamemodes or something.


leaks is a romanian site dedicated to SA-MP, but also programming in other languages.


Yea, ik,i didn\'t not need it 1024 cells for dialog, i put it for test and i forget to change.


I made a few changes to the code just for your pleasure

I hope you like it. I updated in the post.
It\'s not for my pleasure at all, newbies could look at the script and take in consideration bad practices. You shouldn\'t slack on things if you\'re going to release something regardless of how insignificant you may think it is people revive threads years old which means yours might have an affect on the long run.

Overall good job you should learn more file saving systems for better performace, one last note:
Code:
#define FILTERSCRIPT
 
#include <a_samp>
#include <zcmd>
 
#if defined FILTERSCRIPT
There\'s no need to define something then check if it\'s defined, so the #if defined FILTERSCRIPT then #endif are not needed at all since you already defined above #define FILTERSCRIPT that goes for any other different definition and check.
Reply
#11

Quote:
Originally Posted by Dennis12
View Post
It\'s only a filterscript .. yea, i made a few mistakes by code, but I also mentioned that I did not give too much effort, because it is just an FS you use occasionally, do not implement it on gamemodes or something.


leaks is a romanian site dedicated to SA-MP, but also programming in other languages.


Yea, ik,i didn\'t not need it 1024 cells for dialog, i put it for test and i forget to change.


I made a few changes to the code just for your pleasure

I hope you like it. I updated in the post.
so.... remind me again why you\'re releasing this?
Reply
#12

bravo frate continua tot asa, doar incercand poti ajunge departe nu lua in considerare ce kkt mananca astea pe aici, unii se cred prea buni pentru tot.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)