Help with script PLZ
Moderator: Core Staff
Help with script PLZ
i made a trigger multiple and i want that when a player touches it, he returns to the position before the jump
for example mp_sonic water or the spikes in mp_cheops
pls help me
p.s:
peds i know u can help me
for example mp_sonic water or the spikes in mp_cheops
pls help me
p.s:
peds i know u can help me
Re: Help with script PLZ
user maps\mp\gametypes\cj::loadpos(); or smthing might work too.
Not sure what is in the cj.gsc exactly though.
Not sure what is in the cj.gsc exactly though.
Re: Help with script PLZ
Killersam
I'm sorry but I did not mean that ....
the script works fine but the script teleports in the same spot no matter where jumps
I want that when a player touches the trigger back to exactly where he jumped as water mp_sonic
I do not know you understand what I mean
sorry for my english i used a translator
thanks anyway
I'm sorry but I did not mean that ....
the script works fine but the script teleports in the same spot no matter where jumps
I want that when a player touches the trigger back to exactly where he jumped as water mp_sonic
I do not know you understand what I mean
sorry for my english i used a translator
thanks anyway
Re: Help with script PLZ
Hmm, I don't know the exact code for that, but given that it's DanTheMan's map I'm sure he does
Re: Help with script PLZ
Code: Select all
teleport_onTouch()
{
yourmap_triga = getent("yourmap_triga","targetname");
while(1)
{
yourmap_triga waittill ("trigger",user);
wait .1;
if (isDefined(user.lastPosOnGround) && isPlayer(user)) //might have disconnected within .1 second :-)
user setOrigin(user.lastPosOnGround);
}
}
saveGroundPos()
{
while (1)
{
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
if (players[i].sessionstate == "playing" && players[i] isOnGround())
players[i].lastPosOnGround = players[i].origin;
wait .1;
}
}
Re: Help with script PLZ
megazor wrote:Code: Select all
teleport_onTouch() { yourmap_triga = getent("yourmap_triga","targetname"); while(1) { yourmap_triga waittill ("trigger",user); wait .1; if (isDefined(user.lastPosOnGround) && isPlayer(user)) //might have disconnected within .1 second :-) user setOrigin(user.lastPosOnGround); } } saveGroundPos() { while (1) { players = getEntArray("player", "classname"); for (i = 0; i < players.size; i++) if (players[i].sessionstate == "playing" && players[i] isOnGround()) players[i].lastPosOnGround = players[i].origin; wait .1; } }
thanks but doesn't work
Re: Help with script PLZ
Did you thread both of them, and did you create a trigger_multiple across the area you need, giving it a "yourmap_triga" targetname?
Re: Help with script PLZ
Pedsdude wrote:Did you thread both of them, and did you create a trigger_multiple across the area you need, giving it a "yourmap_triga" targetname?
Yes i did
Re: Help with script PLZ
so you have the following:
ok, then let's do some debugging...
Code: Select all
main()
{
thread saveGroundPos();
thread teleport_onTouch();
}
Code: Select all
teleport_onTouch()
{
trig = getent("yourmap_triga","targetname");
while(1)
{
trig waittill("trigger", user);
//wait .1;
if (!isDefined(user.lastPosOnGround))
user iPrintLn("no saved positions");
else
user setOrigin(user.lastPosOnGround);
}
}
saveGroundPos()
{
while (1)
{
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
{
if (isDefined(players[i].sessionstate) && players[i].sesionstate == "playing")
players[i] iPrintLn("I am playing, lolz");
if (players[i] isOnGround())
players[i] iPrintLn("I am on the ground, rofl");
if (players[i].sessionstate == "playing" && players[i] isOnGround())
players[i].lastPosOnGround = players[i].origin;
}
wait .1;
}
}
Re: Help with script PLZ
Two things:
Check defined of self.sessionstate too, before saving, and use wait 0.05 for best results.
Btw, you might wanna delete the iprinlns xD 10 per second aint funny
Check defined of self.sessionstate too, before saving, and use wait 0.05 for best results.
Btw, you might wanna delete the iprinlns xD 10 per second aint funny
Re: Help with script PLZ
megazor wrote:so you have the following:
ok, then let's do some debugging...Code: Select all
main() { thread saveGroundPos(); thread teleport_onTouch(); }
Code: Select all
teleport_onTouch() { trig = getent("yourmap_triga","targetname"); while(1) { trig waittill("trigger", user); //wait .1; if (!isDefined(user.lastPosOnGround)) user iPrintLn("no saved positions"); else user setOrigin(user.lastPosOnGround); } } saveGroundPos() { while (1) { players = getEntArray("player", "classname"); for (i = 0; i < players.size; i++) { if (isDefined(players[i].sessionstate) && players[i].sesionstate == "playing") players[i] iPrintLn("I am playing, lolz"); if (players[i] isOnGround()) players[i] iPrintLn("I am on the ground, rofl"); if (players[i].sessionstate == "playing" && players[i] isOnGround()) players[i].lastPosOnGround = players[i].origin; } wait .1; } }
THANKS!!! FINALLY WORKS!!!
the iprintlns are funny xD
Re: Help with script PLZ
ye, wait .05 is more accurate but it also loads server more than .1 does.
Who is online
Users browsing this forum: No registered users and 2 guests