Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: DorkeyDear on August 16, 2007, 01:09:31 pm
-
Script Name: Position Saver
Script Description: When a player does /save, his / her position is saved. When (s)he does /load then she is teleported to that last saved location. There is a limitation of the total number of times a player may load his / her position that may be set in one of the constants at the top of the script. Also, there is a required amount of time between save (changeable through a constant), and you must be a at least a certain distance away from the flags and your previously saved position (changeable through constants). Also note that the script does include a limitation of a player's speed when loading, although because GetPlayerStat always returns 0 with the speed variables, it is commented out. It should still work when it is uncommented out in the next version of Soldat Dedicated Server if what is returned is fixed.
Original Author: Curt (Probably based off of EnEsCe's script on his FUN server)
Core Version: 2.6.3
In request from Iq-Unlimited
-
Teh download since Curt was too lazy to add it himself.
-
No! Not true! It was really on my desktop ready to be uploaded, I just forgot! Lol, its now there.
(Hehehe, mine is a smaller size)
-
Cool xD
I'll save position just right by enemy flag XD
-
lol, it was meant for climbs, and also you cant save by a flag.
-
this is really anoying on some climb maps ( i know from enesces sever) on other maps its good.
i say that normal climbing is better than /save and /load
can you save porsitsion then change team then load?
-
can you save porsitsion then change team then load?
yeah.. script is generally meant for a 1-team climb server. It would go well along with a script that auto sets a player team to alpha if they try to change teams.
-
could you reset the players save onjointeam? (just wornding not asking)
-
could you reset the players save onjointeam? (just wornding not asking)
Yeah, just replace "procedure OnJoinGame(ID, Team: byte);" with "procedure OnJoinTeam(ID, Team: byte);", and the script will reset a person's save when they changes teams too.
-
You steel meh script!
-
You steel meh script!
I had it first lawl!!! its mien!
-
You steel meh script!
I had it first lawl!!! its mien!
I take the blame for the suggestion that Curt should go ahead and make it ^^.
-
lol, it was meant for climbs, and also you cant save by a flag.
you can edit it so it can be able to work next to flags >:D
-
lol, it was meant for climbs, and also you cant save by a flag.
you can edit it so it can be able to work next to flags >:D
how? I need 1 please, I need a script that has no limitation inf saves inf loads and you can save anytime anywhere, and next to flags. please make me 1, thanx
-
const
Color = $FF52DD52;
MaxLoads = 3;
SaveTime = 30;
SaveDist = 400;
FlagDist = 500;
You can change FlagDist and SaveDist and SaveTime to 0 for the only limitation being the max number of loads. I might modify it so if you put -1 as the MaxLoads, then there will be no limit, but thats not in there yet.
-
could I put like 100? or whats the max i can put?
-
I'm not sure what datatype it is, sense its a constant... I would assume an integer, so 32767 (No, I did not memorize that number) would be the highest it can be.
-
ok thanx, i think thats enough lol
Date Posted: August 22, 2007, 11:52:21 AM
there is a bug when on ice, you cant save
Date Posted: August 29, 2007, 07:56:16 PM
can u also make it so if a person types /s or /l because it's a hassle to keep typing it out especially if its a hard jump or something.
-
Theres no way to fix the ice thing that I know of.
Doesn't when a person do a 1 letter / command or 2 letter, it actually acts like the person said "s" or "l" or whatever letter is there? I just tested it, when in a server, i did /t and /te and it was as if I typed "t" and "te" but then I did "/tes" and nothing happened.
I'll see if the single or double letter commands actually calls the OnPlayerCommand function, and if it does, then I'll modify the script.
-
If the command is less than 3 chars, it wont work.
-
If the command is less than 3 chars, it wont work.
Do you know if MM has a reason for that? (or you, don't know if its client or server-side)
Date Posted: August 31, 2007, 04:10:38 pm
Update
- Replaced the constants with a settings.ini file
- Added a /loadsettings command
- Script now accepts limitations of player's speed
- Player looses saves when he captures the flag
Date Posted: October 15, 2007, 06:02:55 pm
Update:
- Setting maximum loads to 0 means there is no limit
- Fixed the speed detection being a bit inaccurate
Date Posted: November 01, 2007, 04:17:32 pm
Update:
- Auto loading after respawn is supported (/autoload on/off; server setting in settings.ini sets default state)
- /reset command added to reset loads and saves
-
With that reset youve taken away the 'Can't save to close to last save point' because there is no longer any save point :P
-
heh, good thinking.
i requested a /reset, because if u save it at some dead way, or a deadly polygon, u dont need to disable autoload to spawn at the actual spawn. its indeed abusable, but i dont know why you would want to disallow saving close to the last save point :P
an easy fix for this would be /kill on /reset :P
-
Update:
- Resetting kills you
- Resetting now has a message :)
-
Where to put this script?? I have a dedicated server.
I just wanna know this thing. Answer as soon as possible.
-
read the stickies.
http://forums.soldat.pl/index.php?topic=21468.0
-
is it possible to turn off this script using command?
-
is it possible to turn off this script using command?
Sorry, but no. The most you can disable is autoloading your save point so that people who don't know about the script don't auto get teleported.
-
if some people need save in the middle on the air and whit speed and load in the middle on the air here is the code this position save is unlimited only need settings to load and incluides txt ..
Example:
Remember in a document .ini XD
[Settings]
AutoLoad=true
MaxLoads=0
SaveTime=0
SaveDist=0
FlagDist=0
MaxSpeed=100
Color=$000074E8
And in a document Pas the code XD
enjoy
var
AutoLoadDefault: boolean;
MaxLoads,SaveTime: byte;
Color: longint;
SaveDist,FlagDist,MaxSpeed: single;
Save,AutoLoad,AfterRespawn: array[1..32] of boolean;
Time,Loads: array[1..32] of integer;
SaveX,SaveY: array[1..32] of single;
procedure AppOnIdle(Ticks: integer);
var
i: byte;
begin
for i := 1 to 32 do begin
if Time > 0 then Time := Time - 1;
if AfterRespawn then begin
AfterRespawn := false;
if Save then MovePlayer(i,SaveX,SaveY);
end;
end;
end;
function LoadSettings(File: string): boolean;
begin
try
if ReadINI(File,'Settings','AutoLoad','false') = 'true' then AutoLoadDefault := true else AutoLoadDefault := false;
MaxLoads := StrtoInt(ReadINI(File,'Settings','MaxLoads',' '));
SaveTime := StrtoInt(ReadINI(File,'Settings','SaveTime',' '));
SaveDist := StrtoFloat(ReadINI(File,'Settings','SaveDist',' '));
FlagDist := StrtoFloat(ReadINI(File,'Settings','FlagDist',' '));
MaxSpeed := StrtoFloat(ReadINI(File,'Settings','MaxSpeed',' '));
Color := StrtoInt(ReadINI(File,'Settings','Color',' '));
except
Result := true;
Exit;
end;
end;
procedure ActivateServer();
begin
if LoadSettings('scripts/' + ScriptName + '/settings.ini') then WriteLn(' - ' + ScriptName + ' -> Error while loading settings') else WriteLn('
- ' + ScriptName + ' -> Settings loaded successfully');
end;
function OnPlayerCommand(ID: Byte; Text: string): boolean;
var
FlagAX,FlagAY,FlagBX,FlagBY: single;
begin
Result := false;
Case GetPiece(LowerCase(Text),' ',0) of
'/save': begin
if Copy(Text,7,Length(Text)) <> '' then Exit;
if (Loads[ID] < MaxLoads) or (MaxLoads = 0) then begin
if GetPlayerStat(ID,'Alive') = true then begin
if Time[ID] = 0 then begin
if (Save[ID] = false) or (Distance(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),SaveX[ID],SaveY[ID]) >= SaveDist) then begin
GetFlagsXY(FlagAX,FlagAY,FlagBX,FlagBY);
if (Distance(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),FlagAX,FlagAY) >= FlagDist) and (Distance(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),FlagBX,FlagBY) >= FlagDist) then begin
if GetPlayerStat(ID,'Alive') = true then begin
Time[ID] := SaveTime;
WriteConsole(ID,'Your position has been saved.',Color);
SaveX[ID] := GetPlayerStat(ID,'X');
SaveY[ID] := GetPlayerStat(ID,'Y');
Save[ID] := true;
end else WriteConsole(ID,'You must be standing on the ground to save.',Color);
end else WriteConsole(ID,'You are too close to at least one of the flags.',Color);
end else WriteConsole(ID,'You are too close to your previously saved location to save again.',Color);
end else WriteConsole(ID,'You still have ' + InttoStr(Time[ID]) + ' seconds remaining until you may save again.',Color);
end else WriteConsole(ID,'You must be alive to save your location.',Color);
end else WriteConsole(ID,'It is pointless to save when you can not load.',Color);
end;
'/load': begin
if Copy(Text,7,Length(Text)) <> '' then Exit;
if GetPlayerStat(ID,'Alive') = true then begin
if (Loads[ID] < MaxLoads) or (MaxLoads = 0) then begin
if Distance(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'Vely')) <= MaxSpeed then begin
if GetPlayerStat(ID,'Alive') = true then begin
if Save[ID] then begin
Loads[ID] := Loads[ID] + 1;
MovePlayer(ID,SaveX[ID],SaveY[ID]);
if AfterRespawn[ID] then AfterRespawn[ID] := false;
MovePlayer(ID,SaveX[ID],SaveY[ID]);
end else WriteConsole(ID,'No save data to load.',Color);
end else WriteConsole(ID,'You must be standing on the ground to load.',Color);
end else WriteConsole(ID,'You are moving too fast to load.',Color);
end else WriteConsole(ID,'You have maxed out on number of loads you are allowed to use. (' + InttoStr(MaxLoads) + ')',Color);
end else WriteConsole(ID,'You must be alive to load your previously saved location.',Color);
end;
'/reset': begin
if Copy(Text,8,Length(Text)) <> '' then Exit;
if Save[ID] then begin
DoDamage(ID,4000);
Save[ID] := false;
SaveX[ID] := 0;
SaveY[ID] := 0;
Loads[ID] := 0;
WriteConsole(ID,'Save data reset.',Color);
end else WriteConsole(ID,'No save data to reset.',Color);
end;
'/autoload': begin
Case LowerCase(GetPiece(Text,' ',1)) of
'on','enable','enabled': begin
if AutoLoad[ID] then WriteConsole(ID,'Auto loading is already enabled.',Color) else begin
AutoLoad[ID] := true;
WriteConsole(ID,'Auto loading has been enabled.',Color);
end;
end;
'off','disable','disabled': begin
if AutoLoad[ID] then begin
AutoLoad[ID] := false;
WriteConsole(ID,'Auto loading has been disabled.',Color);
end else WriteConsole(ID,'Auto loading is already disabled.',Color);
end;
'': if AutoLoad[ID] then WriteConsole(ID,'Auto loading is enabled.',Color) else WriteConsole(ID,'Auto loading is disabled',Color);
else WriteConsole(ID,'Invalid input.',Color);
end;
end;
end;
end;
function OnCommand(ID: Byte; Text: string): boolean;
begin
if Text = '/loadsettings' then if LoadSettings('scripts/' + ScriptName + '/settings.ini') then begin
WriteLn(' - ' + ScriptName + ' -> Error while loading settings');
WriteConsole(ID,'Error while loading settings',Color);
end else begin
WriteLn(' - ' + ScriptName + ' -> Settings loaded successfully');
WriteConsole(ID,'Settings loaded successfully',Color);
end;
end;
procedure OnMapChange(NewMap: string);
var
i: byte;
begin
for i := 1 to 32 do begin
Save := false;
SaveX := 0;
SaveY := 0;
Time := SaveTime;
Loads := 0;
end;
end;
procedure OnJoinGame(ID, Team: byte);
begin
Save[ID] := false;
SaveX[ID] := 0;
SaveY[ID] := 0;
Time[ID] := SaveTime;
Loads[ID] := 0;
AutoLoad[ID] := AutoLoadDefault;
end;
procedure OnFlagScore(ID, TeamFlag: byte);
begin
Save[ID] := false;
SaveX[ID] := 0;
SaveY[ID] := 0;
Time[ID] := SaveTime;
Loads[ID] := 0;
end;
procedure OnPlayerRespawn(ID: byte);
begin
AfterRespawn[ID] := true;
end;
procedure OnJoinTeam(ID, Team: byte);
begin
DrawText(ID,'Thi Position Saver has been edited By Macho' + chr(13) + chr(10) +
'Use commands /save and /load' + chr(13) + chr(10) +
' Have Fun!!!',400,RGB(255,0,0),0.103,60,300);
end;
-
You should put it in [.code]...[./code]s to get rid of the
-
Hello I have just started learning Pascal, so I can't change this script by myself. I want to:
- remove all commands expcept save and load
- I want to start the function when player sais "!save" or "!load", not when he writes in a cmd line
- put saving limit 2 times per map
I will be very thankful when someone help me :)
-
Hello I have just started learning Pascal, so I can't change this script by myself. I want to:
- remove all commands expcept save and load
- I want to start the function when player sais "!save" or "!load", not when he writes in a cmd line
- put saving limit 2 times per map
I will be very thankful when someone help me :)
After installing the script into the server (in working order)....
- For admins theres /loadsettings, and for the public, /save, /load, /reset, and /autoload; I can understand autoload, but sense no admin really knows the load settings command, and reset can be used commonly... Why?
- I'll slightly modify the script after school, but for now, its only /save /load commands.
- to limit to 2 times / map, modify in settings.ini "MaxLoads=2"
-
what about an /autosave option? It would automatically save the position if your coordinates dont change much since say previous second and you have ground under you
-
@DorkeyDear
Can you do fusion this script with "capture logger" from climbing-soldiers.net??
Formula:
<Nick player> has capture the flag on <map name> in <time per capture in seconds [IMPORTAND: Time Start - Join game, not every dead]> with <How many saves> and <How many dies> deads.
Example:
XxX has capture the flag on biaclimb1 in 10 sec. with 5 saves and 2 deads.
Reply me.
BB
-
@DorkeyDear
Can you do fusion this script with "capture logger" from climbing-soldiers.net??
Formula:
<Nick player> has capture the flag on <map name> in <time per capture in seconds [IMPORTAND: Time Start - Join game, not every dead]> with <How many saves> and <How many dies> deads.
Example:
XxX has capture the flag on biaclimb1 in 10 sec. with 5 saves and 2 deads.
Reply me.
BB
I just threw both scripts together, and slightly modified it, so tell me if there are any bugs.
The file is attached.
Note that the log files still follow the old format, nothing changed with them, just the message that is said to everybody when the player scores the flag.
-
It's almost excellent!
But...
1. You do "...with 0 loads...". It's good, but may you do "...with 0 loads AND # SAVES..."??
2. May you do this massage "to divide in two" to 2 massages?? See you:
Now:
________________________________
|[*]xXx.........................and dea|
________________________________
I need:
_________________________________
|[*]xXx............................ |
|[*]..............and # deads |
_________________________________
[*] <--- server massage
You understand me??
Reply fast.
BB.
-
Try this...
-
I search bug...Almost All is good working, but :
I 2 saves on map and when i cap the flag server write: 0 saves...
-
I search bug...Almost All is good working, but :
I 2 saves on map and when i cap the flag server write: 0 saves...
most climb servers usually have next map start, or player auto-killed/respawned when they cap, so i had it reset all stats for the player when they capped. Here you go (its an option up top in the constants), try this.
-
It's working! IT'S WORKING!!! ^^
Thank you very much.
@BUG...
May you do timer start if any1 join the game??
-
It's working! IT'S WORKING!!! ^^
Thank you very much.
@BUG...
May you do timer start if any1 join the game??
every1 has their own timer, resets when they respawn
-
timer, resets when they respawn
May you do timer DON'T resets when they respawn??
-
Theres a constant up top...
-
This still don't work(timer started - join game)...
New idea!
You may do "other" timer - ... # minutes and # seconds ...??
-
This still don't work(timer started - join game)...
Are you saying you want a timer from the start of the map?
-
This still don't work(timer started - join game)...
Are you saying you want a timer from the start of the map?
Yes... and may you do "other timer" ??
@edit
Do you this???
-
.
-
Hi. For some reason, I can't turn off the auto save option. I typed off, 0, and no but none of them turn it off. Then I went into the server, saved, killed myself and it did it. So I typed /autosave off and it said "the auto save option is already off" or whatever. Help please.
-
Hi. For some reason, I can't turn off the auto save option. I typed off, 0, and no but none of them turn it off. Then I went into the server, saved, killed myself and it did it. So I typed /autosave off and it said "the auto save option is already off" or whatever. Help please.
I think you mean autoload :P
Forgot a bit of code ^^ updated...
-
HI BELL
//ontopic @bell
I have an ancient positionsaver code if you're trying it in my server. The old is good for it.
-
@DonkeyDear
Repair you anything??
-
@DonkeyDear
Repair you anything??
http://forums.soldat.pl/index.php?topic=18900.msg317434#msg317434
-
I download this and i don't see changes...
-
I download this and i don't see changes...
Would have helped if you told me something was wrong...
Its attached.
-
GJ DorkeyDead
May you do timer show minutes and seconds?? "...in x minutes and X seconds..."
-
'tis attached
-
Bugs:
- Timer show time started of respawn again...
- Text: ...secs seconds...
-
- Timer show time started of respawn again...
Not when I test it. ^^
-
where do i put this script???
-
where do i put this script???
try searching the forums with "I need help in installing scripts!" there are pictures and suppport for n00bs unexpirenced people like you
-
I downloaded the script but autoload doesn't work. :| What's wrong, what should I do?
[Settings]
AutoLoad=true
MaxLoads=0
SaveTime=0
SaveDist=0
FlagDist=0
MaxSpeed=255
Color=$FF52DD52
EDIT: Nvm, I got it working :)
-
I tried to get this working on 2.6.4 and it worked well until autoload teleports me in the middle of the map. I tried to save my position to several other places but the result was same. Is the scriptcore messed up or is this just normal compability problems?
-
http://forums.soldat.pl/index.php?topic=33812.0