• CityRP to DarkRP?
    4 replies, posted
I am trying to implement ShopMod on my server, but this part of the mod (the part that has to do with money) is coded for CityRP - which obviously isn't compatible with DarkRP. Where can I find the equivalents of the code, such as "ply.cityrp._Money" for DarkRP? I'm not asking you to spoon-feed me or anything, but a few pointers in the right direction would be awesome! :smile: [CODE]//ShopMod Hooks //You MUST edit the functions below to work with your RP. Some RP gamemodes are already set up here. //RP gamemodes currently set up: //CityRP //Has Money local function shopmod_hasmoney( ply, amt ) if( cityrp != nil ) then return ply.cityrp._Money >= amt elseif( CUR != nil and GlobalInts != nil and CfgVars != nil ) then return ply:CanAfford( amt ) elseif( GMRP != nil ) then return ply:HasMoney( amt ) elseif( DevM_Function_Think ) then return ply:GetNWInt( "ZD_Money" ) >= amt else return true end end hook.Add( "ShopModHasMoney", "smmoneycheck", shopmod_hasmoney ) //Do money local function shopmod_domoney( ply, amt ) if( cityrp != nil ) then cityrp.player.giveMoney( ply, amt ) elseif( CUR != nil and GlobalInts != nil and CfgVars != nil ) then ply:AddMoney( amt ) elseif( GMRP != nil ) then ply:AddMoney( amt ) elseif( DevM_Function_Think ) then ply:SetNWInt( "ZD_Money", ply:GetNWInt( "ZD_Money" ) + amt ) end end hook.Add( "ShopModDoMoney", "smdomoney", shopmod_domoney ) local function shopmod_inv( ply, entity, amt ) if( cityrp != nil ) then cityrp.inventory.update( ply, entity, 1 ) elseif( GMRP != nil ) then GMRP.AddToInventory( ply, entity ) else ply:Give( entity ) end end hook.Add( "ShopModDoInventory", "sminv", shopmod_inv ) local function shopmod_spawn( ply, entity, amt, id ) local vec = shopmod.shops[id]["spawns"][math.random( 1, #shopmod.shops[id]["spawns"] )] local ent = ents.Create( entity ) ent:SetPos( vec ) ent:SetOwner( ply ) ent:Spawn() ent:Activate() end hook.Add( "ShopModDoSpawn", "smspawn", shopmod_spawn )[/CODE] Thanks in advance.
[QUOTE=The Anarchist;35333312]Where can I find the equivalents of the code, such as "ply.cityrp._Money" for DarkRP?[/QUOTE] In the DarkRP code. [editline]Because im nice[/editline] I did some work for you: [lua] p:AddMoney(amount) -- Adds money to DRP wallet p:CanAfford(amount) -- Returns true or false if player can afford the given p.DarkRPVars.money -- The direct value of the players wallet. DO NOT EDIT THIS AS IT WILL NOT SYNC CLIENTSIDE. [/lua]
Fixed, but it won't spawn vehicles. Any ideas? [code]local function shopmod_spawn( ply, entity, amt, id ) local vec = shopmod.shops[id]["spawns"][math.random( 1, #shopmod.shops[id]["spawns"] )] local ent = ents.Create( entity ) ent:SetPos( vec ) ent:SetOwner( ply ) ent:Spawn() ent:Activate() end[/code]
Have to bump this, I really need vehicles. :wink:
Is shopmod.shops a valid table? And are there any spawns set up in it? And where is the hook being called from?
Sorry, you need to Log In to post a reply to this thread.