Sunshine Auto's - by rulk

Started by rulk, Sep 10, 2015, 07:00 PM

Previous topic - Next topic

Eva

#60
Did it manualy now and it works :) thnx

And rulk i looked at your screenshots manual and i do it exactly the same as you show, but it doesnt load the vehicles in sql.blah

and my vehicles are in server.config (old way).

anyway thanks again it works now :)

kennedyarz

fucking mother cows do everything as this in the script but when I try to open the database of sunshine with this browser opens it me blank, not is that it happens, but I think it is the browser but other databases if you open them. before this example if it opened. What happened to the old sunshine? This is empty...

rulk

@kennedyarz

I haven't changed the database, It's meant to be empty. You need to populate it yourself using sql_create.nut.

See the documentation...

-------------------------
STEP-BY-STEP INSTALL GUIDES
-------------------------
Method One - Using the old server.conf
Method Two - You created your vehicles using CreateVehicle()
Using the example Script
We are all god's children.

kennedyarz

Error. When I open the browser I choose Import. then it displays a message and I option of duress in 'NO' then says "BROWSER. EXE STOPPED WORKING"

Thijn

What does your blah.sql contain?

kennedyarz

   CREATE TABLE `MyVehicles` (

         `VehicleID`   INTEGER,

         `VehicleModel`   TEXT,

         `VehicleCat`   TEXT,

         `VehiclePrice`   INTEGER,

         `IsPurchased`   TEXT,

         `IsShared`   TEXT

      );

Thijn

In that case read the install guide.

kennedyarz

#67
help me in line for team views

This does not know that answer. but as he says "it is easy"

Mötley

#68
@rulk I haven't used your script but I have taken the time to read threw and I find it very interesting.
As well as your scripting methods,. This is an interesting release.

This is not a support forum,. @kennedyarz
Please respect author's post when needing help. A kind thing to do is create a support forum and message the content owner in PM that you could use there assistance,. and if the PM does not work just add a link to this post instead.

Also kennedyarz this is not something a rookie plays with or someone like myself technically, Yet I have been scripting for quite some time now. I suggest for you to take the time to read the scripts and study them understand how they work. Learn from rulk. This is not something you just add to a server due to either the server you own sucks and you want to be a boss server owner, This is more of a script you add when your server is successful and you want to treat your player base. Technically this script is pointless without a really decent player base.

@rulk I am glad you have taken the time to create this release for other scriptwriters to be capable to read and understand(if they actually will instead of just attempting to add it to a random server work^^^).
Honestly I do not see myself using this at all instead just reading and understanding.
~*Thank You

Kewun

i have a problem with this goddamn script
i have created the sql file thing it has 30 kb
whenever when i enter a car, and type /car nothing happens, and prints a error in to console
i entered a stinger, and typed /car
error:

AN ERROR HAS OCCURED [the index '113' does not exist]

line 33
 its: local output = @"Model: " + MyVehicles[ vehicle.ID ].VehicleModel + " - "  +
i cant get it to working :( i already readed your installation guide, but i cant make it work

KAKAN

Well, dump the .sql file to a database file and load that database. Usually, any SQLite viewer/editor can do this work.
Click on the import option, then select .sql as the option and locate the sql file.
oh no

Kewun

#71
still the same error
i mean, how to import and then load to that database file?

nvm, i fixed myself

THX!!!

Kewun

Found a exploit in your script in the /buycar command

Players can buy car, but without money.


if ( cmd == "buycar" )
{
// Lets first establish if your in a vehicle
if ( player.Vehicle == null ) MessagePlayer( "[#ff0000]Error: you are not in a vehicle.", player );
else
{
// OK, we're in a vehicle, lets get it's instance into a variable.
local vehicle = player.Vehicle;

// Put the IsPurchased property into a variable, so we can access squirrel's VM built in manipulation functions for that data type.
local val = MyVehicles[ vehicle.ID ].IsPurchased;

// First, check its an empty value ( it's available to buy )
if ( ( val == null ) || ( val.len() == 0 ) )
{
// Then Set the value in our array.
MyVehicles[ vehicle.ID ].IsPurchased = player.Name;

// The array has been updated, so set our value to 'true' so we can save it to the database.
MyVehicles[ vehicle.ID ].Update = true;

// Display whats going on.
MessagePlayer( "[#ff0000]You have now purchased this vehicle.", player );
}

// It's got a value, and is purchased, therefore, not avilable to buy
else MessagePlayer( "[#ff0000]Error: Vehicle not avilable to purchase.", player );
}
}

there isnt any money checks , so a player can buy any car with 0$  in their pocket

Kewun

fixed

if ( cmd == "buycar" )
{
// Lets first establish if your in a vehicle
if ( player.Vehicle == null ) MessagePlayer( "[#ff0000]Error: you are not in a vehicle.", player );
else
{
// OK, we're in a vehicle, lets get it's instance into a variable.
local vehicle = player.Vehicle;

// Put the IsPurchased property into a variable, so we can access squirrel's VM built in manipulation functions for that data type.
local val = MyVehicles[ vehicle.ID ].IsPurchased;

// First, check its an empty value ( it's available to buy )
if ( player.Cash < MyVehicles[vehicle.ID].VehiclePrice ) {
PM("[#ff0000]Not enought cash",player)
return false;
}
if ( ( val == null ) || ( val.len() == 0 ) )
{
// Then Set the value in our array.
MyVehicles[ vehicle.ID ].IsPurchased = player.Name;

// The array has been updated, so set our value to 'true' so we can save it to the database.
MyVehicles[ vehicle.ID ].Update = true;
player.Cash -= MyVehicles[vehicle.ID].VehiclePrice;
// Display whats going on.
MessagePlayer( "[#ff0000]You have now purchased this vehicle.", player );
}

// It's got a value, and is purchased, therefore, not avilable to buy
else MessagePlayer( "[#ff0000]Error: Vehicle not avilable to purchase.", player );
}
}

Kewun

Quote from: Kewun on Aug 21, 2016, 05:48 PMfixed

if ( cmd == "buycar" )
{
// Lets first establish if your in a vehicle
if ( player.Vehicle == null ) MessagePlayer( "[#ff0000]Error: you are not in a vehicle.", player );
else
{
// OK, we're in a vehicle, lets get it's instance into a variable.
local vehicle = player.Vehicle;

// Put the IsPurchased property into a variable, so we can access squirrel's VM built in manipulation functions for that data type.
local val = MyVehicles[ vehicle.ID ].IsPurchased;

// First, check its an empty value ( it's available to buy )
if ( player.Cash < MyVehicles[vehicle.ID].VehiclePrice ) {
PM("[#ff0000]Not enought cash",player)
return false;
}
if ( ( val == null ) || ( val.len() == 0 ) )
{
// Then Set the value in our array.
MyVehicles[ vehicle.ID ].IsPurchased = player.Name;

// The array has been updated, so set our value to 'true' so we can save it to the database.
MyVehicles[ vehicle.ID ].Update = true;
player.Cash -= MyVehicles[vehicle.ID].VehiclePrice;
// Display whats going on.
MessagePlayer( "[#ff0000]You have now purchased this vehicle.", player );
}

// It's got a value, and is purchased, therefore, not avilable to buy
else MessagePlayer( "[#ff0000]Error: Vehicle not avilable to purchase.", player );
}
}

i forgot a little thing, use MessagePlayer instead of PM because in my script i use PM created function.