Hey there, The idea was to add checkpoints temporarily and removing them if the placement is not correct, so that I can understand where I'm putting while I'm mapping.
So far I'm using this:
So the thing is I copy the CreateCheckpoint whole created function from /addcp and paste it on /delcp (pasting the checkpoint).
So I'm not sure I'm not doing it correctly. I know I'm not that good at scripting but trying to learn.
I can add perfectly but it's not deleting anything using /delcp.
The ERROR on console:
So far I'm using this:
Code Select
else if ( cmd == "addcp")
{
local PosX = player.Pos.x;
local PosY = player.Pos.y;
local PosZ = player.Pos.z;
local newline;
CreateCheckpoint(null, 1, true, Vector(PosX.tofloat() , PosY.tofloat() , PosZ.tofloat()), ARGB(255,255,255,255), 2);
MessagePlayer("[#FFFFFF]Check point has been created.!", player);
MessagePlayer("CreateCheckpoint(null, 1, true, Vector("+ PosX.tofloat() +", " + PosY.tofloat() + ", "+ PosZ.tofloat() +", ARGB(255,255,255,255), 2);", player);
print("CHECKPOINT: " + PosX + ", " + PosY + ", " + PosZ);
newline = "CreateCheckpoint(null, 1, true, Vector("+ PosX.tofloat() +", " + PosY.tofloat() + ", "+ PosZ.tofloat() +", ARGB(255,255,255,255), 2); \n";
local f = file("savedcp.txt","a+");
foreach (c in newline)
f.writen(c, 'b');
f.close();
}
else if ( cmd == "delcp")
{
if (text)
{
local cp = text;
cp.Remove()
MessagePlayer("[#FFFFFF]Check point has been removed!", player);
}
else
{
MessagePlayer("[#FFFFFF]write something to remove cp!", player);
}
}
So the thing is I copy the CreateCheckpoint whole created function from /addcp and paste it on /delcp (pasting the checkpoint).
So I'm not sure I'm not doing it correctly. I know I'm not that good at scripting but trying to learn.
I can add perfectly but it's not deleting anything using /delcp.
The ERROR on console:
Code Select
AN ERROR HAS OCCURED [the index 'Remove' does not exist]
CALLSTACK
*FUNCTION [onCommand()] scripts/_MapperSystem.nut line [566]
*FUNCTION [onPlayerCommand()] scripts/main.nut line [1961]
LOCALS
[cp] "CreateCheckpoint(null, 1, true, Vector(-1730.41, -154.432, 14.9084, ARGB(255,255,255,255), 2);"
[text] "CreateCheckpoint(null, 1, true, Vector(-1730.41, -154.432, 14.9084, ARGB(255,255,255,255), 2);"
[cmd] "delcp"
[player] INSTANCE
[this] TABLE
[text] "CreateCheckpoint(null, 1, true, Vector(-1730.41, -154.432, 14.9084, ARGB(255,255,255,255), 2);"
[cmd] "delcp"
[player] INSTANCE
[this] TABLE