English Spawn trable

8 replies
Goto Page
To the start Previous 1 Next To the start
14.01.13 03:56:06 pm
Up
Axel340
User
Offline Off
People, I need a script that will spawn a player with id 1 in another place, on coordinates. Please help.
14.01.13 04:10:21 pm
Up
Jynxxx
User
Offline Off
Something like this? Not sure what you really want.
Code:
1
2
3
4
5
6
addhook("spawn","_spawn")
function _spawn(id)
     if id == 1 then
          parse("setpos 1 xhere yhere") --x and y are in pixels
     end
end
15.01.13 04:55:42 pm
Up
Axel340
User
Offline Off
I wrote the following:
Code:
1
2
3
4
5
6
addhook("spawn","_spawn")
function _spawn(id)
     if id == 1 then
          parse("setpos 1 x "5344" y "512"")
     end
end


But in the console gives this error: LUA ERROR: maps/ch_!prolog.lua:45: ')' expected near '5344'

what wrong?
15.01.13 05:00:36 pm
Up
EP
User
Offline Off
You replaced the strings wrong, this is the way you should do:
Code:
1
2
3
4
5
6
addhook("spawn","_spawn")
function _spawn(id)
     if id == 1 then
          parse("setpos 1 5344 512")
     end
end
15.01.13 05:04:49 pm
Up
VADemon
User
Offline Off
Axel, if you want to insert variables (strings or numbers) into a text (string), the variable must be outside any " or ' and be between 2 points:
Code:
1
2
3
4
x = 5
y = 532

parse("setpos 1 "..x.." "..y)


Else, what @user Jynxxx: meant is that you should have replaced xhere yhere with numbers, nothing more.
edited 1×, last 15.01.13 08:40:59 pm
15.01.13 06:17:30 pm
Up
Axel340
User
Offline Off
i write:
Code:
1
2
3
4
5
6
7
8
9
addhook("spawn","_spawn")
function _spawn(id)
     if id == 1 then
x = 512
y =5344

     parse("setpos 1 "..x.." "512" "..y.." "5344")
     end
end


but the previous error...
p.s. Yes I don't know scripts
pp.s Yes, I mixed up x and y.

[edited]

it works, thanks. only caused an error in another script, the script uploads the specified image 4 times, because of what the screen was very dark.
edited 1×, last 15.01.13 06:32:31 pm
16.01.13 05:12:15 pm
Up
NeverLast
User
Offline Off
And can u make ,witch usgn id?
IMG:http://www.sloganizer.net/style3,NeverLast.png
17.01.13 12:19:42 am
Up
sheeL
User
Offline Off
user NeverLast has written:
And can u make ,witch usgn id?

Code:
1
if player(id,"usgn") == 12345 then
?
To the start Previous 1 Next To the start