Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*--------------------------------------- Sistema de criação de Teleportes IN GAME v2.0 --------------------------------------
- ----------------------------------------- Não retire os creditos, caso o retire dará erro -------------------------------------
- -------------------------------- Creditos a Marcelodell ou Spark_DaSantos pela criação do FS -----------------------------------*/
- #include <a_samp>
- #include <zcmd>
- #include <DOF2>
- #define COR_BRANCO 0xFFFFFFAA
- #define COR_AMARELO 0xFFFF00AA
- #define COR_GRAD 0xCBCCCEFF
- #define DIALOG_CRIAR (1313)
- #define DIALOG_IR (1314)
- #define DIALOG_APAGAR (1315)
- #define DIALOG_ATUALIZAR (1316)
- new Float:angulo,
- Float:x,
- Float:y,
- Float:z,
- arquivo[64],
- interior,
- vw,
- arquivo2[12], //2 células a mais para não causar possiveis BUG's
- String[128];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Teleportes com Salvamento v2.0");
- print(" Carregado com sucesso!");
- print(" ====================================");
- print(" Autor: Marcelodell ou Spark_DaSantos");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_CRIAR)
- {
- if(response)
- {
- if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
- format(arquivo,sizeof(arquivo), "/Locais/%s.ini",inputtext);
- format(arquivo2,sizeof(arquivo2), "Locais.txt");
- if(DOF2_FileExists(arquivo))
- {
- ShowPlayerDialog(playerid, DIALOG_CRIAR, DIALOG_STYLE_INPUT, "{FFFF00}Criar Teleporte", "{FF0000}Esse Nome já está salvo em nosso Banco de Dados\n\n{FFFFFF}Digite outro nome para seu teleporte:", "Criar", "Cancelar");
- return 1;
- }
- DOF2_CreateFile(arquivo);
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angulo);
- DOF2_SetString(arquivo,"Nome",inputtext);
- DOF2_SetString(arquivo2,inputtext,"Salvo no Banco de Dados");
- DOF2_SetFloat(arquivo,"X",x);
- DOF2_SetFloat(arquivo,"Y",y);
- DOF2_SetFloat(arquivo,"Z",z);
- DOF2_SetFloat(arquivo,"Angulo",angulo);
- DOF2_SetInt(arquivo,"Interior",GetPlayerInterior(playerid));
- DOF2_SetInt(arquivo,"VirtualWorld",GetPlayerVirtualWorld(playerid));
- DOF2_SaveFile();
- SendClientMessage(playerid, COR_BRANCO,"Teleporte Criado com Sucesso!");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COR_AMARELO, "Você cancelou a criação de um Novo Teleporte!");
- return 1;
- }
- }
- if(dialogid == DIALOG_IR)
- {
- if(response)
- {
- format(arquivo,sizeof(arquivo), "/Locais/%s.ini",inputtext);
- if(!DOF2_FileExists(arquivo))
- {
- ShowPlayerDialog(playerid, DIALOG_IR, DIALOG_STYLE_INPUT, "{FFFF00}Ir para o Teleporte", "{FF0000}O Teleporte informado não está salvo em nosso Banco de Dados!\n\n{FFFFFF}Digite o nome do Teleporte que você deseja ir:", "Ir", "Cancelar");
- return 1;
- }
- x = DOF2_GetFloat(arquivo,"X");
- y = DOF2_GetFloat(arquivo,"Y");
- z = DOF2_GetFloat(arquivo,"Z");
- angulo = DOF2_GetFloat(arquivo,"Angulo");
- interior = DOF2_GetInt(arquivo,"Interior");
- vw = DOF2_GetInt(arquivo, "VirtualWorld");
- SetPlayerVirtualWorld(playerid, vw);
- SetPlayerInterior(playerid,interior);
- if (GetPlayerState(playerid) == 2)
- {
- SetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
- SetVehicleZAngle(GetPlayerVehicleID(playerid), angulo);
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), vw);
- LinkVehicleToInterior(GetPlayerVehicleID(playerid), interior);
- }
- else
- {
- SetPlayerPos(playerid, x,y,z);
- SetPlayerFacingAngle(playerid, angulo);
- }
- format(String, sizeof(String), "Você foi teleportado até o(a) %s", inputtext);
- SendClientMessage(playerid, COR_BRANCO, String);
- return 1;
- }
- }
- if(dialogid == DIALOG_APAGAR)
- {
- if(response)
- {
- if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
- format(arquivo,sizeof(arquivo), "/Locais/%s.ini",inputtext);
- format(arquivo2,sizeof(arquivo2), "Locais.txt");
- if(!DOF2_FileExists(arquivo))
- {
- ShowPlayerDialog(playerid, DIALOG_APAGAR, DIALOG_STYLE_INPUT, "{FFFF00}Apagar Teleporte", "{FF0000}Este Teleporte não está Registrado em nosso Banco de Dados\n\n{FFFFFF}Digite o nome do Teleporte que você deseja apagar:", "Apagar", "Cancelar");
- return 1;
- }
- DOF2_RemoveFile(arquivo);
- DOF2_SetString(arquivo2,inputtext,"Apagado pelo Usuário");
- DOF2_SaveFile();
- SendClientMessage(playerid, COR_AMARELO,"Local apagado com sucesso!");
- return 1;
- }
- }
- if(dialogid == DIALOG_ATUALIZAR)
- {
- if(response)
- {
- format(arquivo,sizeof(arquivo), "/Locais/%s.ini",inputtext);
- if(!DOF2_FileExists(arquivo))
- {
- ShowPlayerDialog(playerid, DIALOG_ATUALIZAR, DIALOG_STYLE_INPUT, "{FFFF00}Atualizar Teleporte", "{FF0000}O Teleporte informado não está salvo em nosso Banco de Dados!\n\n{FFFFFF}Digite o nome do Teleporte que você deseja Atualizar:", "Atualizar", "Cancelar");
- return 1;
- }
- DOF2_RemoveFile(arquivo);
- DOF2_CreateFile(arquivo);
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angulo);
- DOF2_SetString(arquivo,"Nome",inputtext);
- DOF2_SetFloat(arquivo,"X",x);
- DOF2_SetFloat(arquivo,"Y",y);
- DOF2_SetFloat(arquivo,"Z",z);
- DOF2_SetFloat(arquivo,"Angulo",angulo);
- DOF2_SetInt(arquivo,"Interior",GetPlayerInterior(playerid));
- DOF2_SetInt(arquivo,"VirtualWorld",GetPlayerVirtualWorld(playerid));
- DOF2_SaveFile();
- SendClientMessage(playerid, COR_AMARELO,"Teleporte atualizado com sucesso!");
- return 1;
- }
- }
- return 1;
- }
- CMD:criarteleporte(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
- ShowPlayerDialog(playerid, DIALOG_CRIAR, DIALOG_STYLE_INPUT, "{FFFF00}Criar Teleporte", "{FFFFFF}Digite o nome para o seu novo Teleporte:", "Criar", "Cancelar");
- return 1;
- }
- CMD:irteleporte(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
- ShowPlayerDialog(playerid, DIALOG_IR, DIALOG_STYLE_INPUT, "{FFFF00}Ir para o Teleporte", "{FFFFFF}Digite o nome do Teleporte que você deseja ir:", "Ir", "Cancelar");
- return 1;
- }
- CMD:apagarteleporte(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
- ShowPlayerDialog(playerid, DIALOG_APAGAR, DIALOG_STYLE_INPUT, "{FFFF00}Apagar Teleporte", "{FFFFFF}Digite o nome do Teleporte que você deseja apagar:", "Apagar", "Cancelar");
- return 1;
- }
- CMD:atualizarteleporte(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
- ShowPlayerDialog(playerid, DIALOG_ATUALIZAR, DIALOG_STYLE_INPUT, "{FFFF00}Atualizar Teleporte", "{FFFFFF}Digite o nome do Teleporte que você deseja Atualizar:", "Atualizar", "Cancelar");
- return 1;
- }
- CMD:locais(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
- new loc[512];
- if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
- new File:ftw=fopen("Locais.txt",io_read);
- SendClientMessage(playerid, COR_AMARELO, "==================== LOCAIS ====================");
- new l;
- while(fread(ftw,loc))
- {
- l++;
- if(l==0)
- {
- SendClientMessage(playerid,COR_BRANCO,"Nenhum Local Salvo no Banco de Dados");
- }
- else
- {
- SendClientMessage(playerid,COR_BRANCO,loc);
- }
- }
- fclose(ftw);
- return 1;
- }
- CMD:creditosteleporte(playerid, params[])
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Creditos do Sistema de Teleportes v2.0", "------------- Sistema de Teleportes -------------\n------------- Com Salvamento IN GAME -------------\nCriado por: Marcelodell ou Spark_DaSantos", "OK", "");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement