[QUOTE=Crap-Head;27397150]On PS_GiveItem() what would I insert if I use this out of pointshop. Like I have my button where it does that function but like PS_GiveItem(item_test) or what? Would I be able to insert something like that there, and what would that be?[/QUOTE]
PS_GiveItem("ItemName") where the name is the filename of the item without the .lua extension.
[editline]14th January 2011[/editline]
[QUOTE=werewolf0020;27396381]ok thanks for the help now i only need the function that opens the PointShop menu so i can call it when i press E on my npc[/QUOTE]
ply:PS_ShowShop(true)
again thanks for the help undefined but i got one last problem
i created my NPC based on the shop npc gmod lua tutorial
then i used this code
(ENT.Base = "base_ai" -- This entity is based on "base_ai"
ENT.Type = "ai" -- What type of entity is it, in this case, it's an AI.
ENT.AutomaticFrameAdvance = true -- This entity will animate itself.
function ENT:SetAutomaticFrameAdvance( bUsingAnim ) -- This is called by the game to tell the entity if it should animate itself.
self.AutomaticFrameAdvance = bUsingAnim
end
-- Since this file is ran by both the client and the server, both will share this information.
local Category = "Your NPC Category"
local NPC = { Name = "Your NPC", Class = "npc_citizen",
Model = "models/humans/group01/female_01.mdl", Health = "100", KeyValues = { citizentype = 4 }, Category = Category }
list.Set( "NPC", "npc_yourfirstNPC", NPC )
function ENT:Initialize( ) --This function is run when the entity is created so it's a good place to setup our entity.
self:SetModel( "models/humans/group01/female_01.mdl" ) -- Sets the model of the NPC.
self:SetHullType( HULL_HUMAN ) -- Sets the hull type, used for movement calculations amongst other things.
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX ) -- This entity uses a solid bounding box for collisions.
self:CapabilitiesAdd( CAP_ANIMATEDFACE | CAP_TURN_HEAD ) -- Adds what the NPC is allowed to do ( It cannot move in this case ).
self:SetUseType( SIMPLE_USE ) -- Makes the ENT.Use hook only get called once at every use.
self:DropToFloor()
self:SetMaxYawSpeed( 90 ) --Sets the angle by which an NPC can rotate at once.
end
function ENT:OnTakeDamage()
return false -- This NPC won't take damage from anything.
end
function ENT:AcceptInput( ply )
if Name == "Use" then
ply:PS_ShowShop(true)
end
end
)
but now i cant spawn the NPC on my gmod npc spawnmenu and if i try to use gmod_spawnnpc MyNPCNameHere it says Sorry you cant spawn this npc!
sorry for the noob question im still new to lua
You stole mah idea XD (Not like I posted it anywhere)
...but in mine I wanted to have some SQL database to connect few servers
[QUOTE=Netheous;27405546]You stole mah idea XD (Not like I posted it anywhere)
...but in mine I wanted to have some SQL database to connect few servers[/QUOTE]
[QUOTE=_Undefined;25847564]
Sync items/points across servers! [url]http://www.facepunch.com/threads/1023540-WIP-MySQL-PData-Replacement[/url][/QUOTE]
[QUOTE=_Undefined;27403599]PS_GiveItem("ItemName") where the name is the filename of the item without the .lua extension.[/QUOTE]
Hmm.
I am using the rev 61 due to it was the only one working when i started to work on this. And in rev 61, all the items was in the same file.
Here is a example of an item:
[lua]
Speed50 = {
Name = "Speed lvl 2",
Enabled = true,
Description = "Increase your speed with 50%",
Cost = 700,
Model = "models/props_c17/streetsign005b.mdl",
Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,
OnTake = function(ply, item)
ply:SetRunSpeed(520)
end
},
Hooks = {
PlayerSpawn = function(ply, item)
ply:SetRunSpeed(780)
end
}
},
[/lua]
Now. Am i right if i say that i use this: Speed50?
So PS_GiveItem(Speed50)
[QUOTE=Crap-Head;27408174]Hmm.
I am using the rev 61 due to it was the only one working when i started to work on this. And in rev 61, all the items was in the same file.
Here is a example of an item:
[lua]
Speed50 = {
Name = "Speed lvl 2",
Enabled = true,
Description = "Increase your speed with 50%",
Cost = 700,
Model = "models/props_c17/streetsign005b.mdl",
Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,
OnTake = function(ply, item)
ply:SetRunSpeed(520)
end
},
Hooks = {
PlayerSpawn = function(ply, item)
ply:SetRunSpeed(780)
end
}
},
[/lua]
Now. Am i right if i say that i use this: Speed50?
So PS_GiveItem(Speed50)[/QUOTE]
PS_GiveItem("Speed50")
The latest revision is working fine now though.
[QUOTE=_Undefined;27408617]PS_GiveItem("Speed50")
The latest revision is working fine now though.[/QUOTE]
Oh yea, forgot about the ""
I have already modifed and added alot of new items to rev 61. + Ive almost made a achivement system in this. So im not planning to update to the new version.
[QUOTE=Crap-Head;27408983]Oh yea, forgot about the ""
I have already modifed and added alot of new items to rev 61. + Ive almost made a achivement system in this. So im not planning to update to the new version.[/QUOTE]
Fair enough.
I'm nearly finished on moving hats clientside. This will improve performance and avoid the jittery hats thing. I've also made it so you can set hats to attachments [b]or[/b] bones, which will allow items other than hats (like penises, should you wish).
awesome! so if i would like to attach a armour to the player i would only copy the hat code and change the model?
[QUOTE=werewolf0020;27412677]awesome! so if i would like to attach a armour to the player i would only copy the hat code and change the model?[/QUOTE]
Pretty much. I'll make some example armor. Be aware that it won't be real armor as the model is drawn clientside.
[QUOTE=_Undefined;27410378]Fair enough.
I'm nearly finished on moving hats clientside. This will improve performance and avoid the jittery hats thing. I've also made it so you can set hats to attachments [b]or[/b] bones, which will allow items other than hats (like penises, should you wish).[/QUOTE]
Argh damn. Now you are just making me update to the new version to fix the flashing on the hats. Il move everything over sometime this weekend.
I found a bug, if you buy the 100 health, then lose 100 health, and sell the health item, it glitches funny lol, the hud doesnt show, you cant change weapons, but if you take damage again you die
*tested in singleplayer*
Also low gravity and super speed wear off when you spawn, but its still in inventory
[QUOTE=Andriko1;27414731]I found a bug, if you buy the 100 health, then lose 100 health, and sell the health item, it glitches funny lol, the hud doesnt show, you cant change weapons, but if you take damage again you die
*tested in singleplayer*
Also low gravity and super speed wear off when you spawn, but its still in inventory[/QUOTE]
Fixed the health thing, thanks. Update out soon with clientside hats and a few fixes.
[editline]14th January 2011[/editline]
Updated. You'll have to modify any custom hats.
This is pretty awesome.
If you could add some support for winning rounds in Fretta, that'd be pretty awesome.
[b][url=wiki.garrysmod.com/?title=Gamemode.OnRoundWinner]Gamemode.OnRoundWinner [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] and [b][url=wiki.garrysmod.com/?title=Gamemode.OnRoundResult]Gamemode.OnRoundResult [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] are the hooks that'd need to be used I think.
I think that the points given to players by killing NPCs should be based on the killed NPC's health, because 10 points per dead NPC is kinda too much
[QUOTE=ROFLBURGER;27424881]I think that the points given to players by killing NPCs should be based on the killed NPC's health, because 10 points per dead NPC is kinda too much[/QUOTE]
Then change it in the config file?
I think you should add "titles shop" and Points Per Hour
ok well i tried to hook the ply:PS_ShowShop(true) when i press E on my npc so it would work as a shopnpc
but then when i test it in-game it says Attemtep to call method PS_ShowShop (a Nill value)
and heres the code i was using well the interaction part of it
function ENT:AcceptInput( name, activator, caller )
if( !caller:IsValid() || !caller:IsPlayer() || name != "Use" ) then return end
print( "ShopMod NPC: Player used shop " .. shopmod.shops[self.Entity.shop]["name"] )
shopmod:SendShopData( self.Entity.shop, caller, function()
umsg.Start( "ShopNPCUsed", activator )
umsg.Short( self.Entity.shop )
umsg.End() end )
end
end
local function myMenu( ply )
ply:PS_ShowShop(true)
end
[editline]15th January 2011[/editline]
btw if i use ply:PS_GiveItem("pistol") it says
[addons\pointshop\lua\sv_player_extension.lua:59] attempt to index local 'item' (a boolean value)
[QUOTE=werewolf0020;27430152]lack of lua tags[/QUOTE]
I highly doubt this will play nice with shopmod. Why do you need both anyway?
becouse i want to bind the PS_ShoShow(true) function when i press E on my npc so it works like a Store NPC
[lua]
function ENT:AcceptInput(name, activator, caller)
if activator:IsValid() and activator:IsPlayer() and name == "Use" then
activator:PS_ShowShop(true)
end
end
[/lua]
But still, having both PointShop and ShopMod will probably break something.
[editline]15th January 2011[/editline]
[QUOTE=werewolf0020;27430152][addons\pointshop\lua\sv_player_extension.lua:59] attempt to index local 'item' (a boolean value)[/QUOTE]
Will fix this.
Dosn't remember points or anything now some random items were in my inv and when i join in chat it said i had my usual points however in top left said i had 0 and also in the shop it said i had 0.
I gave myself 1 point and it updates mine to my old like 1200 points.
Any ideas? Everything else (items) and hats seem to work fine.
Dont have PointShop and ShopMod at the same time. They will probably overwrite eachother and then break. Just use PointShop or ShopMod. Only one at time.
okay but then how can i bind the Pointshop(trye) when i press e on a Simple NPC?
[QUOTE=werewolf0020;27452128]okay but then how can i bind the Pointshop(trye) when i press e on a Simple NPC?[/QUOTE]
[QUOTE=_Undefined;27436243][lua]
function ENT:AcceptInput(name, activator, caller)
if activator:IsValid() and activator:IsPlayer() and name == "Use" then
activator:PS_ShowShop(true)
end
end
[/lua][/QUOTE]
Yeah, the latest update seemed to break mine, i was at 81, upgraded now its all broke.
How about posting errors instead of 'its broke'. Also, it's working fine on SP and SRCDS for me.
[QUOTE=Mrkrabz;27451859]Dosn't remember points or anything now some random items were in my inv and when i join in chat it said i had my usual points however in top left said i had 0 and also in the shop it said i had 0.
I gave myself 1 point and it updates mine to my old like 1200 points.
Any ideas? Everything else (items) and hats seem to work fine.[/QUOTE]
That's all i know. I upgraded some files now its broke.
How could i change it so they get points when they kill someone, and then they can buy more guns with the points.. If you can, just pm me your steam id and ill add u and we can talk.
Thanks
It already does that. Just make more weapon items.
Sorry, you need to Log In to post a reply to this thread.