CREDITS:
Basic Property System
(with pickup model changing)
This is simple, basic, and ready for you to develop !What is the advantage ? Once you bought a property, pickup model will change:
from
to
Don't know if you are aware of what this means, but requires more things to take care of.(because you cannot just change a pickup's model via pickup.Model)You have to remove the old pickup, then recreate it and "push" the "old" data to the new pickup, and blablabla....(all of this happening when random pickups can still be created in server, so IDs might get lost)But with my system, you are free to create any pickup you want, but only after loading all the properties from database, if there is any.
Available commands:- /addprop <price> <name>
- /delprop
- /myprops
- /buyprop
- /sellprop
- /shareprop <player>
- /unshareprop
1.Create a new file called: BasicPropertySystem.nut
2.Insert this code inside it ^
/*
Basic Property System by sseebbyy
(with pickup model changing)
*/
const NO_OWNER_MSG = "no owner";
const NO_SHARING_MSG = "not shared";
const NO_DESCRIPTION_MSG = "No description yet.";
const NO_PROP_OWNED = "no property owned.";
const NO_PROP_SHARED = "no property shared.";
const PROPS_LOCATION = "Properties.db";
const PROPS_LIMIT = 40;
const PROP_MODEL_FORSALE = 407;
const PROP_MODEL_BOUGHT = 406;
const PROP_CREATE = 1;
const PROP_RELOAD = 2;
const PROP_UPDATE = 3;
const RGB_BLUE = "[#37a2ef]";
const RGB_GREY = "[#e0e0e0]";
//-------------------------------------------------------------
class Property
{
ID = null;
Name = null;
Price = null;
Owner = null;
Sharing = null;
Description = null;
x = null;
y = null;
z = null;
World = null;
}
//-------------------------------------------------------------
prop <- array( PROPS_LIMIT, null );
lastPickupPickedUp <- array( GetMaxPlayers(), null )
_srv_Properties <- 0;
dbProperties <- ConnectSQL( PROPS_LOCATION );
QuerySQL ( dbProperties, "CREATE TABLE IF NOT EXISTS Properties ( ID INT, Name TEXT, Price INT, Owner TEXT, Sharing TEXT, Description TEXT, x FLOAT, y FLOAT, z FLOAT, World INT )" );
print( "Basic Property System was loaded." );
//-------------------------------------------------------------
function pMSG( text, player )
{
return MessagePlayer( RGB_BLUE + text.tostring(), player );
}
function UpdateProperty( id, name, price, owner, sharing, description, x, y, z, world )
{
local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
else FreeSQLQuery( see_dbProperties );
QuerySQL( dbProperties,
format(@"UPDATE [Properties] SET
[ID]=%i,
[Price]=%i,
[Owner]='%s',
[Sharing]='%s',
[Description]='%s',
[x]=%f,
[y]=%f,
[z]=%f,
[World]=%i
WHERE [Name]='%s';",
prop[ id ].ID.tointeger(), price.tointeger(), owner.tostring(), sharing.tostring(), description.tostring(), x.tofloat(), y.tofloat(), z.tofloat(), world.tointeger(),
name.tostring()
)
);
prop[ id ].ID = prop[ id ].ID;
prop[ id ].Name = name;
prop[ id ].Price = price;
prop[ id ].Owner = owner;
prop[ id ].Sharing = sharing;
prop[ id ].Description = description;
prop[ id ].x = x;
prop[ id ].y = y;
prop[ id ].z = z;
prop[ id ].World = world;
}
function CreateProperty( name, price, x, y, z, world )
{
local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
else FreeSQLQuery( see_dbProperties );
local p = CreatePickup( PROP_MODEL_FORSALE, world, 0, x, y, z, 255, true );
if( p )
{
prop[ p.ID ] = null;
prop[ p.ID ] = Property(); // important
prop[ p.ID ].ID = _srv_Properties;
prop[ p.ID ].Name = name;
prop[ p.ID ].Price = price;
prop[ p.ID ].Owner = NO_OWNER_MSG;
prop[ p.ID ].Sharing = NO_SHARING_MSG;
prop[ p.ID ].Description = NO_DESCRIPTION_MSG;
prop[ p.ID ].x = x;
prop[ p.ID ].y = y;
prop[ p.ID ].z = z;
prop[ p.ID ].World = world;
local query = format( "INSERT INTO Properties ( ID, Name, Price, Owner, Sharing, Description, x, y, z, World ) VALUES ( %i, '%s', %i, '%s', '%s', '%s', %f, %f, %f, %i )",
_srv_Properties, name, price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, x, y, z, world );
QuerySQL( dbProperties, query );
_srv_Properties += 1;
}
}
function ReloadProperty( property, model )
{
if( typeof( property ) == "instance" )
{
local pid = property.ID,
dbpid = prop[ pid ].ID,
name = prop[ pid ].Name,
see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
else FreeSQLQuery( see_dbProperties );
local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Name='" + escapeSQLString( name ) + "'" );
if( listQuery )
{
FindPickup( pid ).Remove();
prop[ pid ] = null;
local p = CreatePickup( model, GetSQLColumnData( listQuery, 9), 0, GetSQLColumnData( listQuery, 6 ), GetSQLColumnData( listQuery, 7 ), GetSQLColumnData( listQuery, 8 ), 255, true );
if( p )
{
local id = p.ID;
prop[ id ] = null;
prop[ id ] = Property(); // important
prop[ id ].ID = dbpid;
prop[ id ].Name = GetSQLColumnData( listQuery, 1 );
prop[ id ].Price = GetSQLColumnData( listQuery, 2 );
prop[ id ].Owner = GetSQLColumnData( listQuery, 3 );
prop[ id ].Sharing = GetSQLColumnData( listQuery, 4 );
prop[ id ].Description = GetSQLColumnData( listQuery, 5 );
prop[ id ].x = GetSQLColumnData( listQuery, 6 );
prop[ id ].y = GetSQLColumnData( listQuery, 7 );
prop[ id ].z = GetSQLColumnData( listQuery, 8 );
prop[ id ].World = GetSQLColumnData( listQuery, 9 );
}
FreeSQLQuery( listQuery );
}
}
}
function RemoveProperty( property )
{
if( typeof( property ) == "instance" )
{
local id = property.ID,
dbid = prop[ id ].ID,
name = prop[ id ].Name,
see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
else FreeSQLQuery( see_dbProperties );
local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Name='" + escapeSQLString( name ) + "'" );
if( listQuery )
{
FindPickup( id ).Remove();
prop[ id ] = null;
QuerySQL( dbProperties, "DELETE FROM 'Properties' WHERE Name='" + name + "'" );
FreeSQLQuery( listQuery );
}
}
}
function OwnedProperties( player )
{
if( FindPlayer( player.ID ) )
{
local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
else FreeSQLQuery( see_dbProperties );
local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Owner='" + escapeSQLString( player.Name ) + "'" );
if( listQuery )
{
local res = "";
while( GetSQLColumnData( listQuery, 1 ) )
{
res += GetSQLColumnData( listQuery, 1 ) + ", ";
GetSQLNextRow( listQuery );
}
FreeSQLQuery( listQuery );
res = res.slice( 0, res.len() - 2 );
return res;
}
else return NO_PROP_OWNED;
}
}
function SharedProperties( player )
{
if( FindPlayer( player.ID ) )
{
local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
else FreeSQLQuery( see_dbProperties );
local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Sharing='" + escapeSQLString( player.Name ) + "'" );
if( listQuery )
{
local res = "";
while( GetSQLColumnData( listQuery, 1 ) )
{
res += GetSQLColumnData( listQuery, 1 ) + ", ";
GetSQLNextRow( listQuery );
}
FreeSQLQuery( listQuery );
res = res.slice( 0, res.len() - 2 );
return res;
}
else return NO_PROP_SHARED;
}
}
function LoadProperties( )
{
print( "[dbProps] Loading properties..." );
local modelid, listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties'" );
if( listQuery )
{
while( GetSQLColumnData( listQuery, 1 ) )
{
modelid = PROP_MODEL_FORSALE;
if( GetSQLColumnData( listQuery, 3 ) != NO_OWNER_MSG ) modelid = PROP_MODEL_BOUGHT;
local p = CreatePickup( modelid, GetSQLColumnData( listQuery, 9), 0, GetSQLColumnData( listQuery, 6 ), GetSQLColumnData( listQuery, 7 ), GetSQLColumnData( listQuery, 8 ), 255, true );
if( p )
{
local count = _srv_Properties;
prop[ count ] = Property(); // important
prop[ count ].ID = p.ID;
prop[ count ].Name = GetSQLColumnData( listQuery, 1 ).tostring();
prop[ count ].Price = GetSQLColumnData( listQuery, 2 ).tointeger();
prop[ count ].Owner = GetSQLColumnData( listQuery, 3 ).tostring();
prop[ count ].Sharing = GetSQLColumnData( listQuery, 4 ).tostring(),
prop[ count ].Description = GetSQLColumnData( listQuery, 5 ).tostring();
prop[ count ].x = GetSQLColumnData( listQuery, 6 ).tofloat();
prop[ count ].y = GetSQLColumnData( listQuery, 7 ).tofloat();
prop[ count ].z = GetSQLColumnData( listQuery, 8 ).tofloat();
prop[ count ].World = GetSQLColumnData( listQuery, 9 ).tointeger();
_srv_Properties += 1;
}
else print( "[dbProps] Couldn't load property with name: " + GetSQLColumnData( listQuery, 1 ) );
GetSQLNextRow( listQuery );
}
}
print( "[dbProps] " + _srv_Properties + " properties have been loaded from the database." );
}
3. Now we have to deal with the main script, so put this under onScriptLoad():
dofile( "scripts/BasicPropertySystem.nut" );
LoadProperties();
4. onPlayerCommand( player, command, text )
local cmd = command.tolower();
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
5. onPickupPickedUp( player, pickup )
if( pickup.Model == 407 || pickup.Model == 406 )
{
if( prop[ pickup.ID ] != null )
{
local id = pickup.ID,
propid = prop[ id ].ID,
name = prop[ id ].Name,
price = prop[ id ].Price,
owner = prop[ id ].Owner,
sharing = prop[ id ].Sharing,
description = prop[ id ].Description;
lastPickupPickedUp[ player.ID ] = id;
return pMSG( "Property ID: " + RGB_GREY + propid + RGB_BLUE + " Name: " + RGB_GREY + name + RGB_BLUE + " Price: " + RGB_GREY + price + RGB_BLUE + " Owner: " + RGB_GREY + owner + RGB_BLUE + " Sharing: " + RGB_GREY + sharing + RGB_BLUE + " Description: " + RGB_GREY + description, player );
}
}
[spoiler=PlayerToPoint() function if you don't have it]
function PlayerToPoint( player, radi, x, y, z )
{
local tempposx, tempposy, tempposz;
tempposx = player.Pos.x -x;
tempposy = player.Pos.y -y;
tempposz = player.Pos.z -z;
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
[/spoiler]
PS: To buy/sell/del/share/unshare a property you need to be near it's pickup.
PS2: You must place CreateProperties before any other CreatePickup() !
PS3: Limits and Database location is specified in top of BasicPropertySystem.nut.
(be sure you know what you doin' when changing those constants
Nice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server
Quote from: happymint2 on Apr 13, 2017, 08:05 AMNice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server
cuz most of the vcmp scripter use sqlite for their server. Btw it isn't much hard to make it work with mysql.
Quote from: Cool on Apr 13, 2017, 08:05 AMNice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server
A few reasons, most important one is that its self-sustained. It doesn't need a backend server. How do think VCMP people would be able to setup a MySQL server without any problems even if there's a tutorial for it?
I myself prefer SQLite over MySQL, because, VCMP is not worth it. You won't be having more than a few 100 accounts on your server, so, there's no need of MySQL.
The need for MySQL is necessary if you need to access the database from places other than the server. Like having a web-stats page. Then you'd need MySQL because SQLite would have some struggles with concurrency. Other than that, you simply don't need MySQL. Period.
Quote from: S.L.C on Apr 13, 2017, 11:06 AMThe need for MySQL is necessary if you need to access the database from places other than the server. Like having a web-stats page. Then you'd need MySQL because SQLite would have some struggles with concurrency. Other than that, you simply don't need MySQL. Period.
i also need mysql for that As SLC Said
Quote from: Cool on Apr 13, 2017, 11:47 AMi also need mysql for that As SLC Said
SLC didn't mention you in his post + are you requesting mysql database? ???
Quote from: zeus on Apr 13, 2017, 12:01 PMQuote from: Cool on Apr 13, 2017, 11:47 AMi also need mysql for that As SLC Said
SLC didn't mention you in his post + are you requesting mysql database? ???
what???
Nice work
@sseebbyyand a suggestion
function pMSG( text, player )
{
return MessagePlayer( RGB_BLUE + text.tostring() );
}
Change For
function pMSG( text, player )
{
return MessagePlayer( RGB_BLUE + text.tostring() ,player);
}
And I think this is necessary
lastPickupPickedUp <- array( GetMaxPlayers(), null )
thanks
Hm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Quote from: kennedyarz on Apr 13, 2017, 12:36 PMNice work @sseebbyy
and a suggestion
Great pointed
@kennedyarz ! Thank you very much !
First post will be updated asap, so check it out.
Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql
Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Well, you can't create 2 connections to the same SQLite database for querying. But, what you can do is, create 1 connection for the main server, and others for just selecting, that's what SQLite can do.
The real problem is that, your other application should be able to access the database or it can't work.
Quote from: Cool on Apr 13, 2017, 01:13 PMQuote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql
You can do that, if you have some cool idea of how to.
Quote from: KAKAN on Apr 13, 2017, 01:51 PMQuote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Well, you can't create 2 connections to the same SQLite database for querying. But, what you can do is, create 1 connection for the main server, and others for just selecting, that's what SQLite can do.
The real problem is that, your other application should be able to access the database or it can't work.
Quote from: Cool on Apr 13, 2017, 01:13 PMQuote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql
You can do that, if you have some cool idea of how to.
for finding ideas and then implementing it why dont use mysql its better and simple choice :D
Quote from: Cool on Apr 13, 2017, 08:05 AMWhy all people Releasing things in sqlite You guys should post in both
That's why you use a library (https://forum.vc-mp.org/?topic=4300.0).
But do we really need to use MySQL for such a System?
I see it benefic for account System, because online stats.. But for property? Players would better check them ingame :)
why this topic started to be holywar about databases :<
Help me it gives error on cmd : AN ERROR HAS OCCURED [the index 'command' does not exist
CALLSTACK
FUNCTION [onPlayerCommand<> [the indenx 'command' does not exist ]
Quote from: Yankee on May 27, 2017, 08:29 AMHelp me it gives error on cmd : AN ERROR HAS OCCURED [the index 'command' does not exist
Use this format for your function:
onPlayerCommand( player, command, text )
Then
(by the instalation guide of this system) you will have this as a top line in the function:
local cmd = command.tolower();
Quote from: sseebbyy on May 27, 2017, 09:26 AMQuote from: Yankee on May 27, 2017, 08:29 AMHelp me it gives error on cmd : AN ERROR HAS OCCURED [the index 'command' does not exist
Use this format for your function:
onPlayerCommand( player, command, text )
Then (by the instalation guide of this system) you will have this as a top line in the function:
local cmd = command.tolower();
Thanks mate
like +1
Problem Solved............ :D
When I hit the pickup, nothing happens ...
Only appeared once.
Quote from: [UK]Razor5K. on Jun 08, 2017, 02:09 PMWhen I hit the pickup, nothing happens ...
Only appeared once.
Give error screenshot. you did not copy paste properly.
function onPickupPickedUp( player, pickup )
{
if ( pickup.Model == 407 )
{
if( prop[ pickup.ID ] != null )
{
local id = pickup.ID,
propid = prop[ id ].ID,
name = prop[ id ].Name,
price = prop[ id ].Price,
owner = prop[ id ].Owner,
sharing = prop[ id ].Sharing,
description = prop[ id ].Description;
C_MSG2( "ID:[#FFFFFF] " + propid + " [#FFFF00]Nome:[#FFFFFF] " + name + " [#FFFF00]Preco:[#FFFFFF] " + price + "[#FFFF00].", player );
}
}
if ( pickup.Model == 406 )
{
if( prop[ pickup.ID ] != null )
{
local id = pickup.ID,
propid = prop[ id ].ID,
name = prop[ id ].Name,
price = prop[ id ].Price,
owner = prop[ id ].Owner,
sharing = prop[ id ].Sharing,
description = prop[ id ].Description;
C_MSG( "[#CAE1FF]ID:[#FFFFFF] " + propid + " [#CAE1FF]Nome:[#FFFFFF] " + name + " [#CAE1FF]Dono:[#FFFFFF] " + owner + " [#CAE1FF]Compartilhada com:[#FFFFFF] " + sharing + "[#CAE1FF].", player );
}
}
}
Try implementing my script in a blank server. If it works, then it's good.
This will mean you have implemented it wrongly in your screenshoted server.
Quote from: sseebbyy on Jun 08, 2017, 03:39 PMTry implementing my script in a blank server. If it works, then it's good.
This will mean you have implemented it wrongly in your screenshoted server.
When I create a property it works correctly, but when I reboot the server from this error.
Quote from: Razor5K. on Jun 08, 2017, 03:51 PMWhen I create a property it works correctly, but when I reboot the server from this error.
Be sure you did take care of this:
Quote from: first postPS2: You must place CreateProperties before any other CreatePickup() !
Just added in my server now and watched the whole code Very nice work how you done it just few queries + clean code no spam :D
Just awesome work nothing else
Quote from: Cool on Jul 26, 2017, 09:53 AMJust added in my server now and watched the whole code Very nice work how you done it just few queries + clean code no spam :D
Just awesome work nothing else
Thanks! I'm still
pretty sure it could be done a lot better than this, haha.
@. what do you say ?
It is best Property System Provided in Forums
But
@Cool What need to bump? When You can Like This Post or Can Message Seby Personally?
Do you wanna Increase Posts?
Quote from: Terror_Styles on Jul 27, 2017, 05:39 AMIt is best Property System Provided in Forums
But @Cool What need to bump? When You can Like This Post or Can Message Seby Personally?
Do you wanna Increase Posts?
Yessssss I loveee increasing my posts i am best spammer over the forum.
Any problem? actually i want to beat
@KAKAN post count
also i just shared my exprience about prop system because some of new members were saying not working and etc better not to teach me what should i do
Quote from: Cool on Jul 27, 2017, 07:01 AMYessssss I loveee increasing my posts i am best spammer over the forum.
Any problem? actually i want to beat @KAKAN post count
Never.
Quote from: KAKAN on Jul 27, 2017, 10:14 AMQuote from: Cool on Jul 27, 2017, 07:01 AMYessssss I loveee increasing my posts i am best spammer over the forum.
Any problem? actually i want to beat @KAKAN post count
Never.
Please Go Their Please
http://forum.vc-mp.org/?topic=4969.0
Quote from: sseebbyy on Apr 12, 2017, 10:05 PM4. onPlayerCommand( player, command, text )
local cmd = command.tolower();
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
5. onPickupPickedUp( player, pickup )
if( pickup.Model == 407 || pickup.Model == 406 )
{
if( prop[ pickup.ID ] != null )
{
local id = pickup.ID,
propid = prop[ id ].ID,
name = prop[ id ].Name,
price = prop[ id ].Price,
owner = prop[ id ].Owner,
sharing = prop[ id ].Sharing,
description = prop[ id ].Description;
lastPickupPickedUp[ player.ID ] = id;
return pMSG( "Property ID: " + RGB_GREY + propid + RGB_BLUE + " Name: " + RGB_GREY + name + RGB_BLUE + " Price: " + RGB_GREY + price + RGB_BLUE + " Owner: " + RGB_GREY + owner + RGB_BLUE + " Sharing: " + RGB_GREY + sharing + RGB_BLUE + " Description: " + RGB_GREY + description, player );
}
}
[spoiler=PlayerToPoint() function if you don't have it]
function PlayerToPoint( player, radi, x, y, z )
{
local tempposx, tempposy, tempposz;
tempposx = player.Pos.x -x;
tempposy = player.Pos.y -y;
tempposz = player.Pos.z -z;
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
[/spoiler]
PS: To buy/sell/del/share/unshare a property you need to be near it's pickup.
PS2: You must place CreateProperties before any other CreatePickup() !
PS3: Limits and Database location is specified in top of BasicPropertySystem.nut.
(be sure you know what you doin' when changing those constants
Please Seebbyyy go their
http://forum.vc-mp.org/?topic=4969.0
Can someone help me,i have a problem i did everything in the instructions but it give error
AN ERROR HAS OCCURED [the index 'pSMG' does not exist' Please help me guys.
@Sebastian Please lock its a nice and working script these type of replies will ruin topic
Quote from: Yankee on Aug 03, 2017, 07:17 PMCan someone help me,i have a problem i did everything in the instructions but it give error
AN ERROR HAS OCCURED [the index 'pSMG' does not exist' Please help me guys.
Change that to pMSG
Quote from: Cool on Aug 03, 2017, 07:33 PM@Sebastian Please lock its a nice and working script these type of replies will ruin topic
Please try to help newcommers, you were too new once.
ahh
@Xmair yep i am agree with you but pSMG there is no word like that in real script and i tested this script on blank script there was no error
@Sebastian, iTs Work MAN Keep it up,
Bro I Need Command /setpropname Can u Give Me Bro I Really Need it
@umar4911 might be right.
Tell me the arguments of your onPlayerCommand( )
Quote from: Mohamed on Dec 17, 2017, 10:45 AM@Sebastian, iTs Work MAN Keep it up,
Bro I Need Command /setpropname Can u Give Me Bro I Really Need it
Quote from: Sebastian on Dec 19, 2017, 11:04 AM@umar4911 might be right.
Tell me the arguments of your onPlayerCommand( )
function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
@Sebastian[spoiler]
function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
if (cmd == "execc")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
SendDataToClient( player, 4, arguments );
}
}
else if (cmd == "exec")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
try
{
local cscr = compilestring(arguments);
cscr();
}
catch (e) Message("Execution Error " + e);
}
}
else if (cmd == "register")
{
if (!status[player.ID].Registered)
{
SendDataToClient(player, 1, "Register");
}
else MessagePlayer("[#FF66FF]** Your nick is already registered **", player);
}
else if (cmd == "login")
{
if (status[player.ID].Registered && !status[player.ID].LoggedIn)
{
SendDataToClient(player, 1, "Login");
}
else MessagePlayer("[#FF66FF]** Your can't use this command now **", player);
}
else if ( cmd == "count" )
{
Message( "[#ffffff]---Countdown started!---" );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 4000, 1, "-> GO <-",1000, 1500, 300 );
}
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
else if ( cmd == "test" )
{
CreatePickup(407, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true);
}
else if (cmd == "autologin")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if (status[player.ID].AutoLogin) status[player.ID].AutoLogin = false;
else status[player.ID].AutoLogin = true;
MessagePlayer("[#FF66FF]** Auto Login Status : " + status[player.ID].AutoLogin, player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "changepass")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if(arguments)
{
status[ player.ID ].Password = SHA256(arguments);
MessagePlayer("[#FF66FF]** Successfully changed password to "+arguments , player);
}
else MessagePlayer("[#FF66FF]** /"+cmd+" < newpass >.", player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "cmds")
MessagePlayer("[#FF66FF]** | /register | /login | /autologin | /changepass | /credits | /exec | **" , player);
else if (cmd == "credits")
MessagePlayer("[#FF66FF]** Thanks to Anik for registration sytem and thanks to Sebastian for the property system." , player);
else MessagePlayer("[#FF66FF]** Unknown command. Use /cmds for a list of available commands." , player);
}
[/spoiler]
and a new error appeared or... [spoiler]
[/spoiler]
@umar4911 It worked well but the command is not creating any property just showing
[spoiler]
[/spoiler]
and nothing works after that.
All Nice Working but
this not working .?:
myprops
buyprop
i am using this \spoiler of command on load
@Haxerx all works but buyprop myprops not working >?:
Quote from: haxerx on Dec 19, 2017, 05:13 PM@Sebastian
[spoiler]function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
if (cmd == "execc")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
SendDataToClient( player, 4, arguments );
}
}
else if (cmd == "exec")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
try
{
local cscr = compilestring(arguments);
cscr();
}
catch (e) Message("Execution Error " + e);
}
}
else if (cmd == "register")
{
if (!status[player.ID].Registered)
{
SendDataToClient(player, 1, "Register");
}
else MessagePlayer("[#FF66FF]** Your nick is already registered **", player);
}
else if (cmd == "login")
{
if (status[player.ID].Registered && !status[player.ID].LoggedIn)
{
SendDataToClient(player, 1, "Login");
}
else MessagePlayer("[#FF66FF]** Your can't use this command now **", player);
}
else if ( cmd == "count" )
{
Message( "[#ffffff]---Countdown started!---" );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 4000, 1, "-> GO <-",1000, 1500, 300 );
}
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
else if ( cmd == "test" )
{
CreatePickup(407, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true);
}
else if (cmd == "autologin")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if (status[player.ID].AutoLogin) status[player.ID].AutoLogin = false;
else status[player.ID].AutoLogin = true;
MessagePlayer("[#FF66FF]** Auto Login Status : " + status[player.ID].AutoLogin, player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "changepass")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if(arguments)
{
status[ player.ID ].Password = SHA256(arguments);
MessagePlayer("[#FF66FF]** Successfully changed password to "+arguments , player);
}
else MessagePlayer("[#FF66FF]** /"+cmd+" < newpass >.", player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "cmds")
MessagePlayer("[#FF66FF]** | /register | /login | /autologin | /changepass | /credits | /exec | **" , player);
else if (cmd == "credits")
MessagePlayer("[#FF66FF]** Thanks to Anik for registration sytem and thanks to Sebastian for the property system." , player);
else MessagePlayer("[#FF66FF]** Unknown command. Use /cmds for a list of available commands." , player);
}
[/spoiler]
and a new error appeared or... [spoiler][/spoiler]
@umar4911 It worked well but the command is not creating any property just showing
[spoiler][/spoiler]
and nothing works after that.
Let us see the actual error FFS.
Do you understand what I'm saying?
Quote from: Xmair on Dec 19, 2017, 06:33 PMQuote from: haxerx on Dec 19, 2017, 05:13 PMand a new error appeared or... [spoiler][/spoiler]
@umar4911 It worked well but the command is not creating any property just showing
[spoiler][/spoiler]
and nothing works after that.
Let us see the actual error FFS.
Actually, I meant that /addprop is not working well for me and I came here to find a solution to solve.
And I believe no error were appeared just something is preventing the command to create properties.
Check if there is only one "text" declared, in the whole onPlayerCommand()
Also, I can open no Spoiler... dunno why.
sEBASTIAN I AM COPY THE Spoiler
but buyprop myprops not working for me wHY :"(
Quote from: Sebastian on Dec 20, 2017, 12:39 AMCheck if there is only one "text" declared, in the whole onPlayerCommand()
Also, I can open no Spoiler... dunno why.
Probably when you were scrolling down it auto loaded the next page and merged it with the page, that's a Wedge error. Just refresh your page to make it work.
Quote from: Xmair on Dec 19, 2017, 06:33 PMQuote from: haxerx on Dec 19, 2017, 05:13 PM@Sebastian
[spoiler]function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
if (cmd == "execc")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
SendDataToClient( player, 4, arguments );
}
}
else if (cmd == "exec")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
try
{
local cscr = compilestring(arguments);
cscr();
}
catch (e) Message("Execution Error " + e);
}
}
else if (cmd == "register")
{
if (!status[player.ID].Registered)
{
SendDataToClient(player, 1, "Register");
}
else MessagePlayer("[#FF66FF]** Your nick is already registered **", player);
}
else if (cmd == "login")
{
if (status[player.ID].Registered && !status[player.ID].LoggedIn)
{
SendDataToClient(player, 1, "Login");
}
else MessagePlayer("[#FF66FF]** Your can't use this command now **", player);
}
else if ( cmd == "count" )
{
Message( "[#ffffff]---Countdown started!---" );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 4000, 1, "-> GO <-",1000, 1500, 300 );
}
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
else if ( cmd == "test" )
{
CreatePickup(407, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true);
}
else if (cmd == "autologin")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if (status[player.ID].AutoLogin) status[player.ID].AutoLogin = false;
else status[player.ID].AutoLogin = true;
MessagePlayer("[#FF66FF]** Auto Login Status : " + status[player.ID].AutoLogin, player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "changepass")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if(arguments)
{
status[ player.ID ].Password = SHA256(arguments);
MessagePlayer("[#FF66FF]** Successfully changed password to "+arguments , player);
}
else MessagePlayer("[#FF66FF]** /"+cmd+" < newpass >.", player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "cmds")
MessagePlayer("[#FF66FF]** | /register | /login | /autologin | /changepass | /credits | /exec | **" , player);
else if (cmd == "credits")
MessagePlayer("[#FF66FF]** Thanks to Anik for registration sytem and thanks to Sebastian for the property system." , player);
else MessagePlayer("[#FF66FF]** Unknown command. Use /cmds for a list of available commands." , player);
}
[/spoiler]
and a new error appeared or... [spoiler][/spoiler]
@umar4911 It worked well but the command is not creating any property just showing
[spoiler][/spoiler]
and nothing works after that.
Let us see the actual error FFS.
I did check the command but it is working for me just there was a semi colon missing which did not make an error. Tell me on code written on line(which shows error).
Semi colon is on the last of the CreateProperty(.......)
;
@umar4911 [spoiler]
[spoiler]
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
[/spoiler]
or this is whole /addprop cmd
[spoiler]
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
//this is line 332 else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
[/spoiler]
[/spoiler]
Quote from: haxerx on Dec 20, 2017, 11:33 AM@umar4911
[spoiler]
[spoiler]else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
[/spoiler]
or this is whole /addprop cmd
[spoiler]else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
//this is line 332 else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
[/spoiler]
[/spoiler]
Put these functions in your code. put them out the all functions.
function GetTok(string, separator, n, ...)
{
local m = vargv.len() > 0 ? vargv[0] : n,
tokenized = split(string, separator),
text = "";
if (n > tokenized.len() || n < 1) return null;
for (; n <= m; n++)
{
text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
}
return text;
}
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
Thank you for attentions brother , I apology for any disturbance I solved the problem.Just I had not the "NumTok" and "GetTok" function nothing was wrong in script.
Thank you once again.
EDIT: Ah, Now I can't buy prop..... :-X
The Index' No_OWNER_MSG" Does Exits wtf? when i type buyprop and when i come to prop not show anything
MarineForce delete this from basicpropsystem.nut
/*
Basic Property System by sseebbyy
(with pickup model changing)
*/
const NO_OWNER_MSG = "no owner";
const NO_SHARING_MSG = "not shared";
const NO_DESCRIPTION_MSG = "No description yet.";
const NO_PROP_OWNED = "no property owned.";
const NO_PROP_SHARED = "no property shared.";
const PROPS_LOCATION = "Properties.db";
const PROPS_LIMIT = 40;
const PROP_MODEL_FORSALE = 407;
const PROP_MODEL_BOUGHT = 406;
const PROP_CREATE = 1;
const PROP_RELOAD = 2;
const PROP_UPDATE = 3;
const RGB_BLUE = "[#37a2ef]";
const RGB_GREY = "[#e0e0e0]";
And add that again at the beginning of main.nut ;)
ok
Thats Was Nice Thanks Bro :o
how can i enter my house and see ::)
if (((tempposx < radi)(tempposx > -radi))((tempposy < radi)(tempposy > -radi))((tempposz < radi)(tempposz > -radi)))
cmd gives error!
Do you rewrite the code?
My browser is showing wrong! :( :( :(
what i would need to do if i want to make a limit for /buyprop for each player, example the limit would be 2-3
the index "NumTok" does not exist Please help!
function GetTok( string, separator, n, ... )
{
local m = ( vargv.len() > 0 ) ? vargv[ 0 ] : n, tokenized = split( string, separator ), text = "";
if ( ( n > tokenized.len() ) || ( n < 1 ) ) return null;
for ( ; n <= m; n++ )
{
text += text == "" ? tokenized[ n - 1 ] : separator + tokenized[ n - 1 ];
}
return text;
}
function NumTok( string, separator )
{
local tokenized = split( string, separator );
return tokenized.len();
}
https://forum.vc-mp.org/?topic=7122.msg46253#msg46253
my pickups are loading./addprop is working but if i close the server and then open the pickups arre not loading and not saving :'( please help me