Kusanagi's Property Script

Started by MacTavish, Nov 14, 2015, 09:45 AM

Previous topic - Next topic

MacTavish


Hello guys last night i made this script from scratch. It might not be useful but newbies and some of my friends needs it so, There are few commands.

/createprop : stand some where near of prop and use this command it will create an pickup on your standing postion and will put the data in props.sqlite.
Syntax:
/createprop <Price> <Prop Name>
Prop Name: put your desired property name here such as Vercitty State or Mansion.

Price: The price for property you want to set.

/buyprop
Syntax:
/buyprop <Property ID>
/sellprop
Syntax:
/sellprop <Property ID>
/shareprop
Syntax:
/shareprop <Property ID> <Player Name>
/unshareprop
Syntax:
/unshareprop <Property ID>
/myprops  /mysharedprops


Download Link: Dropbox Link Mediafire Link
Found Bugs or have Suggestion Please comment below

Update: Disconnecting db on onScriptUnload, Removed server.exe
Another Update: Added GetPlayer Function and using GetTok instead split and using escapeSQLString, Added PropertyID

Links updated


Plugins you need Windows x86, Linux x86

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

KAKAN

#1
1.
You forgot to disconnect the sqlite when the server is turned off.

2.
Why don't you save the things in an array, and later on export/save it to the DB?( you can follow rulk's buycar/getcar system for that)

3.
Read this:- http://forum.vc-mp.org/?topic=898.0
So, please delete the server.exe file, as it is of no use for linux users.

Anyways, Nice work.
oh no

MacTavish

Quote from: KAKAN on Nov 14, 2015, 10:18 AM1.
You forgot to disconnect the sqlite when the server is turned off.

I will update it.

Quote from: KAKAN on Nov 14, 2015, 10:18 AM2.
Why don't you save the things in an array, and later on export/save it to the DB?( you can follow rulk's buycar/getcar system for that)

I will but that will become Hard to understand for some newbies

Quote from: KAKAN on Nov 14, 2015, 10:18 AM3.
Read this:- http://forum.vc-mp.org/?topic=898.0
So, please delete the server.exe file, as it is of no use for linux users.

I didnt included any .exe file

Quote from: KAKAN on Nov 14, 2015, 10:18 AMAnyways, Nice work.

Thanks

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

KAKAN

Quote from: Kusanagi on Nov 14, 2015, 10:33 AM
Quote from: KAKAN on Nov 14, 2015, 10:18 AM3.
Read this:- http://forum.vc-mp.org/?topic=898.0
So, please delete the server.exe file, as it is of no use for linux users.

I didnt included any .exe file

Oh c'mon, my eyes are not that bad.
i can see one server.exe file in your script.

As well as, you didn't tell which plugins are required for this to work
oh no

MacTavish

Quote from: KAKAN on Nov 14, 2015, 10:59 AM
Quote from: Kusanagi on Nov 14, 2015, 10:33 AM
Quote from: KAKAN on Nov 14, 2015, 10:18 AM3.
Read this:- http://forum.vc-mp.org/?topic=898.0
So, please delete the server.exe file, as it is of no use for linux users.

I didnt included any .exe file

Oh c'mon, my eyes are not that bad.
i can see one server.exe file in your script.

As well as, you didn't tell which plugins are required for this to work

Sorry i was too tired when i zipped btw link updated

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

SAzEe21


MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Thijn

Did you test this?

1. else if ( text == GetSQLColumnData(QuerySQL(pdb, "SELECT Name FROM Properties"),0) ) MessagePlayer( "Property Already Exists", player );
How would you expect this to work?

2. Property names cannot contain spaces. Use the format /createprop <price> <name>, so you can take the first argument as price, and the rest (no matter how many elements) as name.

3. You do no SQL escaping, at all. What do you think happens when your nick contains an '? Yes. Your query breaks.

4. MyProps loops through all properties, and does a while loop to see if the owner is you. This will break if your database contains, for example:

ID | Owner
0   | Me
1   | You
2   | Me

Your property will break the while loop, and when I enter the myprops command it will only show the first one.
Fix this by changing your SQL to use WHERE Owner = 'playername', then loop through all returned rows.

5. Same for mysharedprops as #4

6. Why do you sometimes use GetTok (createprop), and other times use split? If this is a script directed at beginners it's important to be consistent.

7. Your onPickupPickedUp function does an if on the query. This is great, but if the query returns nothing (The property does not exist, and the pickup was faulty placed there, for whatever reason) it will continue, and will spam null errors in your face. Check if your data is not null, instead.


As you can see there's still a lot of room for improvement, but there's a beginning.

MacTavish

#8
Thanks @Thijn

Fixing

3. You do no SQL escaping, at all. What do you think happens when your nick contains an '? Yes. Your query breaks.

Would you tell me more about SQL escaping

Edit: i hope you was talking about escapeSQLString(text)

@Thijn can you please check it once more

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

HaCkeR0o1

Kusanagi how i become admin for create new property..................................
Hammad.

MacTavish

Quote from: XammaD^.^ on Dec 08, 2015, 01:44 PMKusanagi how i become admin for create new property..................................
in command createprop i wrote my name "Kusanagi" change it to your name "XammaD^.^"

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

HaCkeR0o1

Ok Thanks but my name is not XammaD^.^ . Now i am HaCkeR0o1
Hammad.

HaCkeR0o1

@Kusanagi can you forword my port using teamviewer please................
Hammad.

KAKAN

Quote from: HaCkeR0o1 on Dec 08, 2015, 02:02 PM@Kusanagi can you forword my port using teamviewer please................
Maybe you can do that shits in PM?
There are many good websites about port forward.
One of the most popular website is:- portforward.com
oh no

HaCkeR0o1

Quote from: KAKAN on Dec 08, 2015, 02:40 PM
Quote from: HaCkeR0o1 on Dec 08, 2015, 02:02 PM@Kusanagi can you forword my port using teamviewer please................
Maybe you can do that shits in PM?
There are many good websites about port forward.
One of the most popular website is:- portforward.com
but i want to forword port for vcmp..........................
Hammad.