Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============
- // SCRIPT CRIADO POR: FROST
- //============
- //============
- /* TABELAS SQL:
- CREATE TABLE IF NOT EXISTS `sistema_de_plantas` (
- `char_id` INT(11) NOT NULL,
- `name` VARCHAR(30) NOT NULL,
- `mapa` VARCHAR(12) NOT NULL,
- `posi_x` INT(3) NOT NULL,
- `posi_y` INT(3) NOT NULL,
- `plant_id` INT(3) NOT NULL,
- `plant_stage` INT(1) NOT NULL,
- `plant_time` INT(11) NOT NULL,
- KEY `char_id` (`char_id`)
- ) ENGINE=MyISAM;
- */
- function script plant_system {
- getmapxy(.@map$, .@mapx, .@mapy, UNITTYPE_PC);
- .@mapy--;
- query_sql "SELECT `plant_id` FROM `sistema_de_plantas` WHERE `mapa`='"+.@map$+"' AND `posi_x`="+.@mapx+" AND `posi_y`="+.@mapy+"",.@pidW;
- if(.@pidW)
- {
- mes "Já existe uma planta aqui!";
- getitem 7193,1;
- close;
- }
- mes "Você quer Plantar aqui? ";
- if(select("Sim:Não")==2){ getitem 7193,1; close; }
- close2;
- .@cid = getcharid(0);
- .@nid$ = strcharinfo(0);
- query_sql "SELECT COUNT(`char_id`) FROM `sistema_de_plantas` WHERE `char_id`='"+.@cid+"'",.@rst;
- for(set .@i,0; .@i<=.@rst; set .@i,.@i+1)
- {
- query_sql "SELECT `plant_id` FROM `sistema_de_plantas` WHERE `char_id`="+getcharid(0)+" ORDER BY `plant_id` ASC",.@rrst;
- if(.@rrst[.@i] != .@i && .@chk < 1){ set .@rst,.@i; set .@chk,1; }
- }
- showscript "Plantando...";
- progressbar "0xFFFFFF", 1;
- set .@pName$," #"+.@rst+getcharid(0)+"";
- duplicatenpc("planta2", .@pName$, sprintf($cid$), .@map$, .@mapx, .@mapy, DIR_SOUTH, 557);
- set .@pTime,gettimetick(2)+60; //60 segundos para regar pela 1º vez
- query_sql "INSERT INTO `sistema_de_plantas` (`char_id`,`name`,`mapa`,`posi_x`,`posi_y`,`plant_id`,`plant_stage`,`plant_time`) VALUES ("+.@cid+",'"+.@nid$+"','"+.@map$+"',"+.@mapx+","+.@mapy+","+.@rst+",0,"+.@pTime+")";
- end;
- }
- - script planta2 -1,{
- query_sql "SELECT `posi_x` FROM `sistema_de_plantas` WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+strcharinfo(3)+"'",.@px2;
- if(.@px2)
- {
- getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC);
- query_sql "SELECT `plant_id`,`posi_x`,`plant_stage`,`plant_time` FROM `sistema_de_plantas` WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+.@map$+"' AND `posi_x`="+.@x+" AND `posi_y`="+.@y+"",.@pidC,.@px,.@stage,.@time;
- if(.@px)
- {
- mes "[^20B2AA Planta ^000000]";
- mes "ID Planta : "+.@pidC;
- mes "Nome Planta: "+strnpcinfo(0)+"";
- mes "Mapa: "+.@map$;
- mes "Posição X: "+.@x;
- mes "Posição Y: "+.@y;
- mes "Estágio: "+.@stage;
- set .@calcT,.@time-gettimetick(2);
- mes ""+(.@stage == 3 ? "Estágio Final:":"Próximo Estágio:")+" "+(.@calcT < 60 ? (.@calcT < 0 ? "0":.@calcT+"seg"):(.@calcT/60)+"min");
- menu (.@stage < 3 ? "Regar":"")+"",-,(.@stage > 0 ? "Cortar":"")+"",-,"ChatRoom",-,"Sair",-;
- set .@mn,@menu;
- switch(.@mn)
- {
- case 1:
- if(gettimetick(2) < .@time){ next; mes "Você ainda não pode regar!"; close; }
- switch(.@stage)
- {
- case 0: //30min
- if(countitem(523) < 1){ next; mes "Para regar a planta você precisa de 1x "+getitemname(523)+" !"; close; }
- set .@pTime,gettimetick(2)+1800;
- query_sql "UPDATE `sistema_de_plantas` SET `plant_stage`=1,`plant_time`="+.@pTime+" WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+.@map$+"' AND `posi_x`="+.@x+" AND `posi_y`="+.@y+"";
- classchange(976,1);
- delitem 523,1;
- break;
- case 1: //30min
- if(countitem(523) < 1){ next; mes "Para regar a planta você precisa de 1x "+getitemname(523)+" !"; close; }
- set .@pTime,gettimetick(2)+1800;
- query_sql "UPDATE `sistema_de_plantas` SET `plant_stage`=2,`plant_time`="+.@pTime+" WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+.@map$+"' AND `posi_x`="+.@x+" AND `posi_y`="+.@y+"";
- classchange(527,1);
- delitem 523,1;
- break;
- case 2: //1h30min
- if(countitem(523) < 1){ next; mes "Para regar a planta você precisa de 1x "+getitemname(523)+" !"; close; }
- set .@pTime,gettimetick(2)+5400;
- query_sql "UPDATE `sistema_de_plantas` SET `plant_stage`=3,`plant_time`="+.@pTime+" WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+.@map$+"' AND `posi_x`="+.@x+" AND `posi_y`="+.@y+"";
- classchange(613,1);
- delitem 523,1;
- break;
- default:
- mes "ERRO: 1"; close;
- }
- close;
- case 2:
- close2;
- set .@sqlD,query_sql("DELETE FROM `sistema_de_plantas` WHERE `char_id` = "+getcharid(0)+" AND `mapa`='"+.@map$+"' AND `posi_x`="+.@x+" AND `posi_y`="+.@y+" AND `plant_id`="+.@pidC+"");
- if(.@sqlD) dispbottom "Erro inesperado ao remover a planta do db!";
- if(getwaitingroomstate(3,strnpcinfo(0))) delwaitingroom strnpcinfo(0);
- duplicateremove(strnpcinfo(0));
- end;
- case 3:
- if(select("Ativar Chat:Desativar Chat")==2){ delwaitingroom strnpcinfo(0); close;}
- if(!getwaitingroomstate(3,strnpcinfo(0))){ mes "já está ativo!"; close; }
- waitingroom "[ "+strcharinfo(0)+" ]",0;
- close;
- default:
- close;
- }
- }
- }
- dispbottom "[^20B2AA Planta ^000000]";
- dispbottom "Essa Planta não é sua.";
- end;
- }
- - script markMapView -1,{
- OnPCLoginEvent:
- query_sql "SELECT `plant_id` FROM `sistema_de_plantas` WHERE `char_id`="+getcharid(0)+" AND `mapa`='"+strcharinfo(3)+"'",.@pidL;
- if(getarraysize(.@pidL))
- {
- for(set .@i,0;.@i<getarraysize(.@pidL); set .@i,.@i+1)
- {
- query_sql "SELECT `posi_x`,`posi_y` FROM `sistema_de_plantas` WHERE `char_id`="+getcharid(0)+" AND `plant_id`="+.@pidL[.@i]+"",.@mapx,.@mapy;
- viewpoint 0,.@mapx,.@mapy,(.@i+1),0xFF0000;
- }
- }
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement