Advertisement
Vodka51200

test for other money

Jun 22nd, 2021
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. AddCSLuaFile("cl_init.lua")
  2. AddCSLuaFile("shared.lua")
  3.  
  4. include("shared.lua")
  5.  
  6. function ENT:Initialize()
  7.     self:SetModel( "models/fungi/sta_skyboxshroom1.mdl" )
  8.    
  9.     self:PhysicsInit(SOLID_VPHYSICS)
  10.     self:SetMoveType(MOVETYPE_VPHYSICS)
  11.     self:SetSolid(SOLID_VPHYSICS)
  12.  
  13.     self:SetUseType(SIMPLE_USE)
  14.    
  15.     self:SetDTInt( 0, CurTime() )
  16.  
  17.     local phys = self:GetPhysicsObject()
  18.     phys:EnableMotion( false )
  19. end
  20.  
  21. function ENT:OnTakeDamage()
  22.     self:Remove()
  23. end
  24.  
  25. util.AddNetworkString( "mushroomMenu" )
  26. util.AddNetworkString( "mushroomAction" )
  27.  
  28. function ENT:Use( ply )
  29.     if ( !self:CanPick() ) then
  30.         ply:ChatPrint( "This mushroom is not ready for picking yet" )
  31.         return
  32.     end
  33.    
  34.     net.Start( "mushroomMenu" )
  35.         net.WriteEntity( self )
  36.     net.Send( ply )
  37. end
  38. ---------
  39. local meta = FindMetaTable("Player")
  40.  
  41. function meta:addCash( cash )
  42.     self:SetNWInt("player_money_illegal",cash)
  43. end
  44.  
  45. -- function addCash(k,v)
  46.     -- ply:SetNWInt("player_money_illegal",cash)
  47. -- end
  48.  
  49. net.Receive( "mushroomAction", function( length, ply )
  50.     local mush2 = net.ReadEntity()
  51.     local cmd = net.ReadString()
  52.    
  53.     local money2 = LocalPlayer():GetNWInt("player_money_illegal") --ajout
  54.     local money3 = money2 + ply:SetNWInt("player_money_illegal",cash)
  55.     if ( mush2:GetPos():Distance( ply:GetPos() ) >= 500 ) then return end
  56.     if ( mush2:GetClass() != "mushroom_grow" ) then return end
  57.    
  58.     if ( cmd == "harvest" ) then
  59.         local mush = ents.Create( "mushroom_eat" )
  60.         mush:SetPos( mush2:GetPos() )
  61.         mush:SetAngles( mush2:GetAngles() )
  62.         mush:Spawn()
  63.        
  64.         mush:GetPhysicsObject():SetVelocity( Vector( math.random( - 300, 300 ), math.random( -300, 300 ), math.random( -300, 300 ) ) )
  65.  
  66.         mush2:Remove()
  67.     elseif ( cmd == "sale" ) then
  68.         mush2:Remove()
  69.        
  70.         ply:addMoney( mushroom.sale_price )
  71.         --ply:SetNWInt("player_money_illegal",1000)
  72.         ply:addCash("player_money_illegal",1000)
  73.         --ply:ChatPrint( "Vous avez recu 35 euros" )
  74.         DarkRP.notify(ply, 0, 4, "vous avez recu 35 €" ) end
  75.         --DarkRP.notify(ply, 0, 4, "vous avez recu "..DarkRP.formatMoney(mushroom.sale_price)..".") end
  76. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement