Anyone got a script that will teleport you to a pos by typing in a word in chat, I want TEAM_STAFF and TEAM_SIT to be able to teleport to setpos 5243.077637 -4066.666748 520.031250;setang 1.525608 90.865730 0.000000 by typing /sit or !sit
Thanks a TON!
Now, I had a script like this but it didn't work, I'm still working on how to do scripts by myself here's the one I did.
Client side AKA lua/autorun
[CODE]DarkRP.declareChatCommand{
command = "sit",
description = "Teleport to the sit room",
delay = 0
}[/CODE]
Server side AKA lua/autorun/server
[CODE]local function Teleport(ply, args)
if ply:Team() == TEAM_STAFF then
ply:SetPos( Vector( 5256.058594 -4067.102783 520.031250 ) )
end
return ""
end[/CODE]
Anyone know what I did wrong?
You declared a local function but didn't hook it into PlayerSay or check if the command was "sit"
[QUOTE=code_gs;50856195]You declared a local function but didn't hook it into PlayerSay or check if the command was "sit"[/QUOTE]
Ahhhh ok. I think I get what you're saying, not trying to be too greedy, but mind showing my a working code?
[code]hook.Add("PlayerSay", "Sit", function(ply, txt)
if (txt == "!sit" or txt == "/sit") then
if (ply:Team() == TEAM_STAFF) then
ply:SetPos(Vector( 5256.058594 -4067.102783 520.031250 ))
end
return ""
end
end)[/code]
[QUOTE=code_gs;50856812][code]hook.Add("PlayerSay", "Sit", function(ply, txt)
if (txt == "!sit" or txt == "/sit") then
if (ply:Team() == TEAM_STAFF) then
ply:SetPos(Vector( 5256.058594 -4067.102783 520.031250 ))
end
return ""
end
end)[/code][/QUOTE]
Where your fuction teleport?
[QUOTE=RandyButter;50857188]Where your fuction teleport?[/QUOTE]
What?
[QUOTE=code_gs;50857639]What?[/QUOTE]
It doesn't work, I type in chat and nothing happen's?
Is the player's team TEAM_STAFF? Where did you put the code?
You need commas between each vector.
[code]
ply:SetPos(Vector( 5256.058594, -4067.102783, 520.031250 ))
[/code]
Ahh Ok, Lemme try that, and I'm putting it in lua/autorun
[editline]11th August 2016[/editline]
[QUOTE=RandyButter;50866706]Ahh Ok, Lemme try that, and I'm putting it in lua/autorun[/QUOTE]
YOOOO it worked! Thanks guys!
Sorry, you need to Log In to post a reply to this thread.