When I get back home I WILL shred my room to pieces to find my xbox joypad
[QUOTE=SgtdawnPCFTW;24435840]Dude, i posted them a minute ago! there 2 posts above your post![/QUOTE]
They were the [B]XBOX Controller[/B] commands not the [B]XBOX Module[/B] commands.
[QUOTE=Wolfo;24420200]Weird, are you sure you aren't doing right and left, up and down at the same moment?[/QUOTE]
I'm sure.
Want this.
[QUOTE=Wolfo;24433852]Shouldn't be hard :v:[/QUOTE]
You appear to be struggling, let me help you out. You should re-read the documentation after reading this code.
[lua]
if (CLIENT) then
error("The implementer of this script didn't read the documentation.")
end
// Example registering controls
local splitscreenJcon = {}
local splitscreenJoystickInit = function()
splitscreenJcon.movex = jcon.register{
uid = "spsc_movex",
type = "analog",
description = "Move left/right",
category = "Splitscreen",
max = 1,
min = -1,
}
splitscreenJcon.movey = jcon.register{
uid = "spsc_movey",
type = "analog",
description = "Move forward/back",
category = "Splitscreen",
max = 1,
min = -1,
}
splitscreenJcon.speed = jcon.register{
uid = "spsc_speed",
type = "digital",
description = "Sprint",
category = "Splitscreen",
}
splitscreenJcon.walk = jcon.register{
uid = "spsc_walk",
type = "digital",
description = "Walk",
category = "Splitscreen",
}
splitscreenJcon.jump = jcon.register{
uid = "spsc_jump",
type = "digital",
description = "Jump",
category = "Splitscreen",
}
splitscreenJcon.duck = jcon.register{
uid = "spsc_duck",
type = "digital",
description = "Crouch",
category = "Splitscreen",
}
splitscreenJcon.attack1 = jcon.register{
uid = "spsc_attack1",
type = "digital",
description = "Primary fire",
category = "Splitscreen",
}
splitscreenJcon.attack2 = jcon.register{
uid = "spsc_attack2",
type = "digital",
description = "Secondary fire",
category = "Splitscreen",
}
hook.Add("Think","joyexample",function()
for i,pl in pairs(player.GetAll()) do
if pl:IsConnected() then
//"Iterating through all the connected players on Think":
// Move forward/back
local val = joystick.Get(pl,"spsc_movey")
if (val == 0 or !val) then
//Issue command to stay put
else
//Issue command to walk forward at a speed of val*-1*maximum_speed
end
// Move left/right
local val = joystick.Get(pl,"spsc_movex")
if (val == 0 or !val) then
//Issue command to stay put
else
//Issue command to walk left at a speed of val*maximum_speed
end
// Jump
local val = joystick.Get(pl,"spsc_jump")
if (val == 0 or !val) then
//Issue command to stay put
else
//Issue command to jump
end
end
end
end)
end
hook.Add("JoystickInitialize","splitscreenJoystickInit",splitscreenJoystickInit)
[/lua]
Wouldn't it be easier to make an SNPC for the other players rather than using a box?
You could replace the player entity altogether, and then overwrite any important functions that deal with detecting the player object.
I was actually thinking of making an NPC-Entity instead of a SNPC since I've never scripted an NPC before and when I tried to make one move it came out as a pain in the ass.
Also thanks Night-Eagle for all his support for this script, testing your code right now, if it works like I thought, it means I finally understood how it works.
What's more, if I figure out some bot commands(Not the simple ones by console), I may put a bot right where the second player is and make it shoot or move on command. It could work.
[tab]Doesn't look[/tab][tab]like working[/tab]
I tried modifying the movey bit into this
[lua] local val = joystick.Get(pl,"spsc_movey")
if (val == 0 or !val) then
//Issue command to stay put
else
pl:ChatPrint("MoveY Works")
end [/lua]
to check if it worked and nothing happened.. what am I doing wrong? I've read the documentation a couple of times...
[QUOTE=adorablepuppy;24452611]Want this.[/QUOTE]
Download it.
It's on the OP :hurr:
[QUOTE=gk99;24472600]Download it.
It's on the OP :hurr:[/QUOTE]
Yeah, I saw that, thanks. Didn't download, as it's not mature yet.
[QUOTE=Wolfo;24469123]I was actually thinking of making an NPC-Entity instead of a SNPC since I've never scripted an NPC before and when I tried to make one move it came out as a pain in the ass.
Also thanks Night-Eagle for all his support for this script, testing your code right now, if it works like I thought, it means I finally understood how it works.
What's more, if I figure out some bot commands(Not the simple ones by console), I may put a bot right where the second player is and make it shoot or move on command. It could work.
[tab]Doesn't look[/tab][tab]like working[/tab]
I tried modifying the movey bit into this
[lua] local val = joystick.Get(pl,"spsc_movey")
if (val == 0 or !val) then
//Issue command to stay put
else
pl:ChatPrint("MoveY Works")
end [/lua]
to check if it worked and nothing happened.. what am I doing wrong? I've read the documentation a couple of times...[/QUOTE]
You did bind an input to spsc_movey, right?
Aside from that, put a message for the other condition to check the error code.
[lua]local val, err = joystick.Get(pl,"spsc_movey")
if (val == 0 or !val) then
pl:ChatPrint("MoveY Zero: "..tostring(val).." : "..tostring(err))
else
pl:ChatPrint("MoveY Works")
end[/lua]
You should add support for dual monitors, and dual monitor setups with separate resolutions.
[QUOTE=Night-Eagle;24478864]You did bind an input to spsc_movey, right?
Aside from that, put a message for the other condition to check the error code.
[lua]local val, err = joystick.Get(pl,"spsc_movey")
if (val == 0 or !val) then
pl:ChatPrint("MoveY Zero: "..tostring(val).." : "..tostring(err))
else
pl:ChatPrint("MoveY Works")
end[/lua][/QUOTE]
Yeah, I used the default spsc_movey you posted. Using that debug code, it still won't work: [B]MoveY Zero: nil : 1[/B]
Yet, if I open the [I]joyconfig[/I] menu, it recognizes the joystick.
Bump, any ideas? I'm doing everything right... what am I missing?
lol .. you don't sign..
Devil: Sign the Contract...............
PS: Plz do, i want this!
You sir win a gold star! Now I do not have to buy gmod again to play with family =D
Oh, and any news on getting the spawn menu and P2 player working?
I'm still working on the P2 Menu, but I need to fix the Controller issue first.
Gmod for xbox hahaha.
4-Player Gmod? Impossible!
...... untill NOW!
[QUOTE=ZenX2;24607318]4-Player Gmod? Impossible![/QUOTE]
Maybe not 4 Players *sniff*, but trust me, it is possible to make it two players.
[QUOTE=VeryNiceGuy;24391913]Will this work for dual monitors?[/QUOTE]
shut up about dual cocks in your mouth
Just sent a PM to Night-Eagle, hoping he'll respond soon.
[QUOTE=Alexis-nyan;24617113]shut up about dual cocks in your mouth[/QUOTE]
i hope you have enjoyed your stay on facepunch but sadly your vacation is over i will now redirect you away: [url="http://www.4chan.org"]Good bye[/url]
[QUOTE=VeryNiceGuy;24644818]i hope you have enjoyed your stay on facepunch but sadly your vacation is over i will now redirect you away: [url="http://www.4chan.org"]Good bye[/url][/QUOTE]
Remove that link. NOW.
[QUOTE=gk99;24650231]Remove that link. NOW.[/QUOTE]
I've never been on 4chan, and I will never go.
Thanks Opera for the fast Show-Site while hovering the mouse on a hot-link.
[QUOTE=Wolfo;24664252]I've never been on 4chan, and I will never go.
Thanks Opera for the fast Show-Site while hovering the mouse on a hot-link.
But I guess who clicked it died.[/QUOTE]
I don't know how Opera works, but I have a feeling when you hover over a link it visits that page anyway in order to generate the thumbnail.
We could ask garry nicely to enable the SS commands? or maybe you can access them using gm_cvar2
Night-Eagle hasn't answered yet...
Sorry, you need to Log In to post a reply to this thread.