Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile("cl_init.lua")
- AddCSLuaFile("shared.lua")
- include("shared.lua")
- function ENT:Initialize()
- self:SetModel( "models/fungi/sta_skyboxshroom1.mdl" )
- self:PhysicsInit(SOLID_VPHYSICS)
- self:SetMoveType(MOVETYPE_VPHYSICS)
- self:SetSolid(SOLID_VPHYSICS)
- self:SetUseType(SIMPLE_USE)
- self:SetDTInt( 0, CurTime() )
- local phys = self:GetPhysicsObject()
- phys:EnableMotion( false )
- end
- function ENT:OnTakeDamage()
- self:Remove()
- end
- util.AddNetworkString( "mushroomMenu" )
- util.AddNetworkString( "mushroomAction" )
- function ENT:Use( ply )
- if ( !self:CanPick() ) then
- ply:ChatPrint( "This mushroom is not ready for picking yet" )
- return
- end
- net.Start( "mushroomMenu" )
- net.WriteEntity( self )
- net.Send( ply )
- end
- ---------
- local meta = FindMetaTable("Player")
- function meta:addCash( cash )
- self:SetNWInt("player_money_illegal",cash)
- end
- -- function addCash(k,v)
- -- ply:SetNWInt("player_money_illegal",cash)
- -- end
- net.Receive( "mushroomAction", function( length, ply )
- local mush2 = net.ReadEntity()
- local cmd = net.ReadString()
- local money2 = LocalPlayer():GetNWInt("player_money_illegal") --ajout
- local money3 = money2 + ply:SetNWInt("player_money_illegal",cash)
- if ( mush2:GetPos():Distance( ply:GetPos() ) >= 500 ) then return end
- if ( mush2:GetClass() != "mushroom_grow" ) then return end
- if ( cmd == "harvest" ) then
- local mush = ents.Create( "mushroom_eat" )
- mush:SetPos( mush2:GetPos() )
- mush:SetAngles( mush2:GetAngles() )
- mush:Spawn()
- mush:GetPhysicsObject():SetVelocity( Vector( math.random( - 300, 300 ), math.random( -300, 300 ), math.random( -300, 300 ) ) )
- mush2:Remove()
- elseif ( cmd == "sale" ) then
- mush2:Remove()
- ply:addMoney( mushroom.sale_price )
- --ply:SetNWInt("player_money_illegal",1000)
- ply:addCash("player_money_illegal",1000)
- --ply:ChatPrint( "Vous avez recu 35 euros" )
- DarkRP.notify(ply, 0, 4, "vous avez recu 35 €" ) end
- --DarkRP.notify(ply, 0, 4, "vous avez recu "..DarkRP.formatMoney(mushroom.sale_price)..".") end
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement