All pastes #513932 Raw Edit

props.lua

public text v1 · immutable
#513932 ·published 2007-05-27 14:02 UTC
rendered paste body
/*---------------------------------------------------------
   Name: LogPropSpawned ( ply, model )
   Desc: This logs who spawned the prop, and what model it was. propid is scrapped
---------------------------------------------------------*/
function LogPropSpawned ( ply, model )

LogAdd ( ply:Name() .. "(" .. ply:SteamID() .. ") spawned a prop with the model '" .. model .. "'" )

end

/*---------------------------------------------------------
   Name: PropBought ( ply, model )
   Desc: This logs who spawned the prop, and what model it was. propid is scrapped
---------------------------------------------------------*/
function BuyProp( ply, model )
if (ply:GetNetworkedInt( "money" ) > 20) then
TakeMoney( ply, 20 )
LogPropSpawned( ply, model )
ply:PrintMessage(HUD_PRINTTALK,"You have bought a prop for 20$")
return true
else
ply:PrintMessage(HUD_PRINTTALK,"You do not have enough money!")
return false
end
end
hook.Add( "PlayerSpawnProp", "BuyProp", BuyProp )