R4Z0R49 / DayZAdmin

DayZAdmin - forked from katzsmile/DayZAdmin
22 stars 17 forks source link

healPlayer in functions.php not working #248

Closed nsonP closed 9 years ago

nsonP commented 9 years ago

Have been trying to fix this function for a while now. The problem is that the function healPlayer in actions.php is not adding the blood type and the flag that tells if it should be visible for the player or not.

$db->Execute("UPDATE Character_DATA SET Medical = '[false,false,false,false,false,false,false,12000,[],[0,0],0,[0,0]]' WHERE CharacterID = ? AND Alive = 1", $CharacterID);

[false,false,false,false,false,false,false,12000,[],[0,0],0,[0,0]]

The new string should look like:

[false,false,false,false,false,false,false,12000,[],[0,0],0,"A",false,[0,0,0]]

A quick fix would be to just update the string with above and have a static blood type but then the players will get the same blood typ every time the function is used.

A better approach that i have been trying to implement is to copy the last original part of the string and then replace the rest with static info.

example:

SET @Part1 := '[false,false,false,false,false,false,false,12000,[],[0,0],0,"';
SET @Part2 :=  (SELECT substring_index(medical, ',"', -1) FROM character_dead where CharacterID = 2);
UPDATE character_dead SET Medical = @Part1+@Part2 WHERE CharacterID = 2;
UPDATE character_dead SET Medical = CONCAT(medical, '@part2') CharacterID = 2;

Its working fine as a mysql query but not together with php and adodb. Any idea of how to fix this one?

wriley commented 9 years ago

I'm pretty short on time these days but this is definitely fixable. I'll try to take a look at it in the next few days.

nsonP commented 9 years ago

Great, tell me if i can help with anything!

Marcuzz commented 9 years ago

I'm uploading a fix for this in a sec. Also added bloodtype to the medical table (Taking a while to clone the project, I haven't been active here for a while)

Marcuzz commented 9 years ago

492107d24d0820edcec9a9d9cc7112fd81581d1e

Fixed :)

wriley commented 9 years ago

Thanks Marcus On May 2, 2015 4:15 PM, "Marcus" notifications@github.com wrote:

492107d https://github.com/R4Z0R49/DayZAdmin/commit/492107d24d0820edcec9a9d9cc7112fd81581d1e

Fixed :)

— Reply to this email directly or view it on GitHub https://github.com/R4Z0R49/DayZAdmin/issues/248#issuecomment-98402633.

R4Z0R49 commented 9 years ago

Cheers Marcuzz, Wriley

nsonP commented 9 years ago

Working like a charm! Tanks!

wriley commented 9 years ago

Closing as fixed