Custom Spawn location based on UID?

Contacted them and they said there is a syntax error in it and i'm not seeming to find the error, any help would be appreciated
 
ya its works. one issue.. if you log out and back in, it will spawn you at the custom spawn spot. i can see this being taken advantage of.. ie in cherno on the run, battle log knowing damn well when you come back youll be at the base.
 
going to share what i learned. (i run on dayz.st, like most do)
short tutorial:

1)go into your database, click the SQL tab on top and put in:

Code:
CREATE TABLE `cust_spawn` (
`unique_id` INT(10) NULL DEFAULT NULL,
`worldspace` VARCHAR(50) NULL DEFAULT NULL
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;

2)then send an email to your host (heres a cut and paste of mine to dayz.st):

Subject: Adding Trigger to DB

I run two servers, and need to add a trigger to the survivor table in my DB. But this requires SUPER ADMIN privileges.

My servers are:
173.193.205.66:3425 (username:xxxxxxxxxxx)
208.43.9.86:3000 (username:xxxxxxxxxx)

Ive already made the cust_spawn table on both servers, now i just need the triggers in the survivor table, heres the trigger:

Code:
CREATE TRIGGER `custom_spawn`
BEFORE INSERT ON `survivor`
FOR EACH ROW
BEGIN
DECLARE x INT;
DECLARE y varchar(50);
SET x = (SELECT `unique_id` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
SET y = (SELECT `worldspace` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
IF NEW.unique_id = x THEN
SET NEW.worldspace=y;
END IF;
END;$$
and obviously the delimiter is set to $$.

Thank you for your time, and assistance,



Took your advice and got nowhere with DAYZST.Below is an email i recieved from them 3 days after i sent it. Below in red.

"The SQL code provided is both incomplete and incorrect.
Please consult the source of the SQL code.
I have had several people request this and they all appear to be copy and pasting the same code."


On Mon, Jun 3, 2013 at 10:29 AM, <[email protected]> wrote:

Adding Trigger to DB

I run one server, and need to add a trigger to the survivor table in my DB. But this requires SUPER ADMIN privileges.

My servers are:
108.168.172.162 (username:MrGrimm)


Ive already made the cust_spawn table on my server, now i just need the trigger in the survivor table, heres the trigger:

Code:
CREATE TRIGGER `custom_spawn`
BEFORE INSERT ON `survivor`
FOR EACH ROW
BEGIN
DECLARE x INT;
DECLARE y varchar(50);
SET x = (SELECT `unique_id` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
SET y = (SELECT `worldspace` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
IF NEW.unique_id = x THEN
SET NEW.worldspace=y;
END IF;
END;$$
and obviously the delimiter is set to $$.

Thank you for your time, and assistance,​
 
one sec grim lemme me check the code i used that worked and see if its the same..
ok so the people who work there just work there with no real knowledge.
theres one of 2 things THEY did wrong, and i dont know which, since i dont know what there end looks like. but im assuming they dont use the same interface as us.. so the little Delimeter box at the bottom isnt there so if that the case this is the code for them to insert.

Code:
delimiter $$
 
CREATE TRIGGER `custom_spawn`
BEFORE INSERT ON `survivor`
FOR EACH ROW
BEGIN
DECLARE x INT;
DECLARE y varchar(50);
SET x = (SELECT `unique_id` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
SET y = (SELECT `worldspace` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
IF NEW.unique_id = x THEN
SET NEW.worldspace=y;
END IF;
END

I switched over to hfb servers, im guessing you missed the special they had going where it was 50% FOR LIFE on dayz servers.. hfb has way more liberal rights to access to their database, tho i was not able to add triggers myself, i did send them an email and they raised my privledges which opened up all kinds of cool shit i could ruin :)
going to go reinsert that code on my test server to double check.

ok i put the right code in now
 
that code is shit tho.. just so you know.. there was one obvious thing missing.. obvious now that i tested it.. this trigger doesnt check to make sure the player is dead when respawning in to the server.. so like if a bunch of dudes are hunting you down in cherno, and you lose them long enough to battlelog, when you come back in, you wont come in in cherno, youll be nice and safe at your custom spawn loc.. guaranteed to be abused.. and i have no idea how to add a 2 checks to 2 different tables to a trigger.. last night i left off trying to figure out if i can make a trigger trigger.. :/ ill let ya know.
 
The reason i want this is for admins only.If we are on the coast and get killed we want to be able to spawn in at our own base. Its not going to be for players. Is this possible ?
 
ya just send them what i gave you. i tested it to verify the database doesnt kick back the code with a syntax error. recopy the code up there tho. the very last line should NOT have ;
 
Just got this back from them.....

I had to modify your code a little, but the following appears to have worked:
delimiter $$
CREATE TRIGGER `custom_spawn` BEFORE INSERT
ON `bliss_1822`.`survivor`
FOR EACH ROW
BEGIN
DECLARE x INT;
DECLARE y varchar(50);
SET x = (SELECT unique_id FROM cust_spawn WHERE unique_id=NEW.unique_id);
SET y = (SELECT worldspace FROM cust_spawn WHERE unique_id=NEW.unique_id);
IF NEW.unique_id = x THEN
SET NEW.worldspace=y;
END IF;
END;
 
ya i dont know if that extra ; at the very last of the code will matter or not.. i inserted it both ways and it didnt kick back, but i know the code on my server didnt have it.
 
Back
Top