Basic Property System (with pickup model changing)

Started by Sebastian, Apr 12, 2017, 10:03 PM

Previous topic - Next topic

Terror_Styles

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?

Cool

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

KAKAN

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.
oh no

FAW[K]EY[E]

Quote from: KAKAN on Jul 27, 2017, 10:14 AM
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.

Please Go Their Please
http://forum.vc-mp.org/?topic=4969.0

FAW[K]EY[E]

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

Yankee

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.

Cool

@Sebastian Please lock its a nice and working script these type of replies will ruin topic

Xmair

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.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Cool

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

Mohamed Boubekri

@Sebastian, iTs Work MAN Keep it up,
Bro I Need Command /setpropname Can u Give Me Bro I Really Need it
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

haxerx

#40
When I try to add new property through /addprop cmd nothing happens in server (in-game) but I get something like this in my server console...Everything is good but I cant add properties to my server and I also copied and pasted the scripts with free of mistakes.



Who will have respite to bow their heads. Prostrations, of their own accord shall trickle from the very eyes. We will go out in Yasrib, bereft of familiar company. And deliberately lose our way in streets. Having reached there, we shall not return. Be it that looking for us, people grow weary

umar4911

Quote from: haxerx on Dec 18, 2017, 09:50 PMWhen I try to add new property through /addprop cmd nothing happens in server (in-game) but I get something like this in my server console...Everything is good but I cant add properties to my server and I also copied and pasted the scripts with free of mistakes.



Try changing text to arguments
I am gamer, programmer and hacker. Try to find me!
xD

Sebastian

@umar4911 might be right.

Tell me the arguments of your onPlayerCommand( )

Mohamed Boubekri

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
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

umar4911

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;
I am gamer, programmer and hacker. Try to find me!
xD