Reducto Posted April 28, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 231 Reputation: 9 Joined: 12/16/11 Last Seen: August 10, 2016 Share Posted April 28, 2013 - script skull -,{ OnPCKillEvent: // anti-suicide, can remove if( killedrid == getcharid(3) ) end; // don't loot in this map if( ! compare( .ALLOW_MAP$, ";" + strcharinfo(3) + ";" ) ) end; set .@size, getarraysize(@SKULL_LOOT_AID); set .@ok, 1; while ( .@i < .@size ) { if ( @SKULL_LOOT_DELAY[.@i] < gettimetick(1) ) { deletearray @SKULL_LOOT_DELAY[.@i], 1; deletearray @SKULL_LOOT_AID[.@i], 1; set .@size, .@size-1; continue; } if ( @SKULL_LOOT_AID[.@i] == killedrid ) set .@ok, 0; set .@i, .@i+1; } set @SKULL_LOOT_DELAY[.@size], gettimetick(1) + .SKULL_DELAY; set @SKULL_LOOT_AID[.@size], killedrid; if ( .@ok ) getnameditem( .SKULL_ID, rid2name(killedrid) ); end; OnInit: // Configs set .SKULL_ID , 7420 ; set .SKULL_DELAY , 120 ; // seconds. setarray .@allow_map$ , "ivory_pvp" ; // Building a Quick Search function for ( set .@size, getarraysize(.@allow_map$); .@i<.@size; set .@i,.@i+1 ) set .ALLOW_MAP$, .ALLOW_MAP$ + ";" + .@allow_map$[.@i]; set .ALLOW_MAP$, .ALLOW_MAP$ + ";"; } Can anybody here help me. I have this table in my sql. DROP TABLE IF EXISTS `char_pk`; CREATE TABLE `char_pk` ( `char_id` int(11) NOT NULL, `kill_count` int(11) NOT NULL default '0', `death_count` int(11) NOT NULL default '0', `score` int(11) NOT NULL default '0', PRIMARY KEY (`char_id`) ) ENGINE=InnoDB; I want every one kill 1 score will be inserted to the sql table. Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 28, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 28, 2013 - script skull -1,{ OnPCKillEvent: // anti-suicide, can remove if( killedrid == getcharid(3) ) end; // don't loot in this map if( ! compare( .ALLOW_MAP$, ";" + strcharinfo(3) + ";" ) ) end; set .@size, getarraysize(@SKULL_LOOT_AID); set .@ok, 1; while ( .@i < .@size ) { if ( @SKULL_LOOT_DELAY[.@i] < gettimetick(1) ) { deletearray @SKULL_LOOT_DELAY[.@i], 1; deletearray @SKULL_LOOT_AID[.@i], 1; set .@size, .@size-1; continue; } if ( @SKULL_LOOT_AID[.@i] == killedrid ) set .@ok, 0; set .@i, .@i+1; } set @SKULL_LOOT_DELAY[.@size], gettimetick(1) + .SKULL_DELAY; set @SKULL_LOOT_AID[.@size], killedrid; if ( .@ok ) getnameditem( .SKULL_ID, rid2name(killedrid) ); query_sql "insert into `char_pk` (`char_id`, `kill_count`, `death_count`, `score`) values ('"+ getcharid(0) +"', '1', '0', '1') on duplicate key update `kill_count` = `kill_count` +1, `score` = `score` +1"; attachrid killedrid; query_sql "insert into `char_pk` (`char_id`, `kill_count`, `death_count`, `score`) values ('"+ getcharid(0) +"', '0', '1', '-1') on duplicate key update `death_count` = `death_count` +1, `score` = `score` -1"; end; OnInit: // Configs set .SKULL_ID , 7420 ; set .SKULL_DELAY , 120 ; // seconds. setarray .@allow_map$, "ivory_pvp"; // Building a Quick Search function for ( set .@size, getarraysize(.@allow_map$); .@i<.@size; set .@i,.@i+1 ) set .ALLOW_MAP$, .ALLOW_MAP$ + ";" + .@allow_map$[.@i]; set .ALLOW_MAP$, .ALLOW_MAP$ + ";"; end; } I just add query_sql "insert into `char_pk` (`char_id`, `kill_count`, `death_count`, `score`) values ('"+ getcharid(0) +"', '1', '0', '1') on duplicate key update `kill_count` = `kill_count` +1, `score` = `score` +1"; attachrid killedrid; query_sql "insert into `char_pk` (`char_id`, `kill_count`, `death_count`, `score`) values ('"+ getcharid(0) +"', '0', '1', '-1') on duplicate key update `death_count` = `death_count` +1, `score` = `score` -1"; update the score +1, kill_count +1 each kill and score -1, death_count +1 for the killed Quote Link to comment Share on other sites More sharing options...
Reducto Posted May 4, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 231 Reputation: 9 Joined: 12/16/11 Last Seen: August 10, 2016 Author Share Posted May 4, 2013 The table is not updating in game. I need to restart the server again to see the update. Please help.! Quote Link to comment Share on other sites More sharing options...
Patskie Posted May 4, 2013 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 1702 Reputation: 241 Joined: 09/05/12 Last Seen: 1 hour ago Share Posted May 4, 2013 The table is not updating in game. I need to restart the server again to see the update. Please help.! No need to restart. I guess it will update once you log out then log in. Quote Link to comment Share on other sites More sharing options...
Question
Reducto
Can anybody here help me. I have this table in my sql.
I want every one kill 1 score will be inserted to the sql table.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.