· 7 years ago · Jan 13, 2019, 10:36 PM
1//============
2// SCRIPT CRIADO POR: TioAkima
3//============
4//============
5//============
6/* TABELAS SQL:
7
8CREATE TABLE IF NOT EXISTS `life_stats` (
9 `char_id` INT(11) NOT NULL,
10 `vida` TINYINT(1) NOT NULL,
11 KEY `char_id` (`char_id`)
12) ENGINE=MyISAM;
13*/
14
15
16- script life_stats -1,{
17
18 .@cid = getcharid(3);
19 .@vida = 0; //alive = 1 and dead = 0
20
21OnPCLoginEvent:
22
23 if (Class == 0) { // verifica se o player é um fantasma (ghost class)
24
25 //if the ID already exists, then it only updates the bd
26 if(query_sql ("SELECT `char_id` FROM `life_stats` WHERE `char_id`="+getcharid(0))){
27
28 query_sql "UPDATE `life_stats` SET `vida`='"+.@vida+"' WHERE `char_id`='"+.@cid+"'";
29 end;
30
31 }else{
32
33 //if the ID does not exist in the table, then it inserts the ID and its vital state: alive = 1 / Dead = 0
34 query_sql "INSERT INTO `life_stats` (`char_id`,`vida`) VALUES ("+.@cid+","+.@vida+")";
35 end;
36
37 }
38
39 }
40
41
42 if(query_sql ("SELECT `char_id` FROM `life_stats` WHERE `vida`="+.@vida)){
43
44// check if the player (independent of the class) is dead (0)
45
46 //if it is dead (0) then add hateffect
47 hateffect 35,-1;
48 end;
49
50 }else{
51
52 // if it is alive (1) then it does nothing
53 end;
54
55 }
56
57end;
58
59}