Robin Hood
Member
ok so after switching to a host that lets me have liberal access privileges in the data base, ive been working on some stuff. I just getting snagged on something.. ill use post as an example from a post:
Custom Spawn location based on UID?
the trigger is:
ok so i got it working, only thing is:
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.
so i wanna add 2 checks to this, the one thats already there, and one that checks the survivor table to see if player is_dead.
so i tried something like:
but somethings wrong with it.. anyone clarify the error?
ive tried:
DECLARE x tinyint(30);
IF NEW.is_dead = 1 AND NEW.unique_id = y
lost
Custom Spawn location based on UID?
the trigger is:
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;$$
ok so i got it working, only thing is:
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.
so i wanna add 2 checks to this, the one thats already there, and one that checks the survivor table to see if player is_dead.
so i tried something like:
PHP:
CREATE TRIGGER `custom_spawn`
BEFORE INSERT ON `survivor`
FOR EACH ROW
BEGIN
DECLARE x tinyint;
DECLARE y INT;
DECLARE z varchar(50);
SET x = (SELECT 'is_dead' FROM 'survivor' WHERE `is_dead`=NEW.is_dead);
SET y = (SELECT `unique_id` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
SET z = (SELECT `worldspace` FROM `cust_spawn` WHERE `unique_id`=NEW.unique_id);
IF NEW.is_dead = 1 AND IF NEW.unique_id = y
SET NEW.worldspace=z;
END IF;
END;
but somethings wrong with it.. anyone clarify the error?
ive tried:
DECLARE x tinyint(30);
IF NEW.is_dead = 1 AND NEW.unique_id = y
lost