Advertisement
marcelodell

Criação de Teleportes In Game v1.0

Apr 16th, 2012
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.06 KB | None | 0 0
  1. /*----------------------------------------- Sistema de criação de Teleportes IN GAME -----------------------------------------
  2. ----------------------------------------- Não retire os creditos, caso o retire dará erro -------------------------------------
  3. -------------------------------- Creditos a Marcelodell ou Spark_DaSantos pela criação do FS -----------------------------------*/
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf2>
  8. #include <DOF2>
  9.  
  10. #define                 COR_BRANCO              0xFFFFFFAA 
  11. #define                 COR_AMARELO             0xFFFF00AA
  12. #define                 COR_GRAD                0xCBCCCEFF
  13.  
  14. new Float:x,Float:y,Float:z, local[64], arquivo[128], interior, vw, arquivo2[128];
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n--------------------------------------");
  19.     print(" Sistema de Teleportes com Salvamento");
  20.     print(" Carregado com sucesso!");
  21.     print(" ====================================");
  22.     print(" Autor: Marcelodell ou Spark_DaSantos");
  23.     print("--------------------------------------\n");
  24.     return 1;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29.     return 1;
  30. }
  31.  
  32. CMD:salvarlocal(playerid, params[])
  33. {
  34.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
  35.     if(sscanf(params, "s[64]", local))  return SendClientMessage(playerid, COR_GRAD,"Use: /salvarlocal [nome do local]");
  36.     if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
  37.     format(arquivo,sizeof(arquivo), "/Locais/%s.ini",local);
  38.     format(arquivo2,sizeof(arquivo2), "Locais.txt");
  39.     if(DOF2_FileExists(arquivo))
  40.     {
  41.         SendClientMessage(playerid, COR_GRAD,"Esse Local já está salvo.\nCaso queira atualiza-lo use /atualizarlocal");
  42.         return 1;
  43.     }
  44.     DOF2_CreateFile(arquivo);
  45.     GetPlayerPos(playerid, x, y, z);
  46.     DOF2_SetString(arquivo,"Nome",local);
  47.     DOF2_SetString(arquivo2,local,"Salvo no Banco de Dados");
  48.     DOF2_SetFloat(arquivo,"X",x);
  49.     DOF2_SetFloat(arquivo,"Y",y);
  50.     DOF2_SetFloat(arquivo,"Z",z);
  51.     DOF2_SetInt(arquivo,"Interior",GetPlayerInterior(playerid));
  52.     DOF2_SetInt(arquivo,"VirtualWorld",GetPlayerVirtualWorld(playerid));
  53.     DOF2_SaveFile();
  54.     SendClientMessage(playerid, COR_AMARELO,"Local salvo com sucesso!");
  55.     return 1;
  56. }
  57. CMD:irlocal(playerid, params[])
  58. {
  59.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
  60.     if(sscanf(params, "s[64]", local))  return SendClientMessage(playerid, COR_GRAD,"Use: /irlocal [nome do local]");
  61.     format(arquivo,sizeof(arquivo), "/Locais/%s.ini",local);
  62.     if(!DOF2_FileExists(arquivo))
  63.     {
  64.         SendClientMessage(playerid, COR_GRAD,"Local não existente.");
  65.         return 1;
  66.     }
  67.     x = DOF2_GetFloat(arquivo,"X");
  68.     y = DOF2_GetFloat(arquivo,"Y");
  69.     z = DOF2_GetFloat(arquivo,"Z");
  70.     interior = DOF2_GetInt(arquivo,"Interior");
  71.     vw = DOF2_GetInt(arquivo, "VirtualWorld");
  72.     SetPlayerVirtualWorld(playerid, vw);
  73.     SetPlayerInterior(playerid,interior);
  74.     if (GetPlayerState(playerid) == 2)
  75.     {
  76.         SetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
  77.         SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), vw);
  78.         LinkVehicleToInterior(GetPlayerVehicleID(playerid), interior);
  79.         SendClientMessage(playerid, COR_AMARELO,"Você foi teleportado com sucesso!");
  80.         return 1;
  81.     }
  82.     else
  83.     {
  84.         SetPlayerPos(playerid, x,y,z);
  85.         SendClientMessage(playerid, COR_AMARELO,"Você foi teleportado com sucesso!");
  86.     }
  87.     return 1;
  88. }  
  89. CMD:apagarlocal(playerid, params[])
  90. {
  91.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
  92.     if(sscanf(params, "s[64]", local))  return SendClientMessage(playerid, COR_GRAD,"Use: /apagarlocal [nome do local]");
  93.     if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
  94.     format(arquivo,sizeof(arquivo), "/Locais/%s.ini",local);
  95.     format(arquivo2,sizeof(arquivo2), "Locais.txt");
  96.     if(!DOF2_FileExists(arquivo))
  97.     {
  98.         SendClientMessage(playerid, COR_GRAD,"Esse local não está registrado em nosso Banco de Dados!");
  99.         return 1;
  100.     }
  101.     DOF2_RemoveFile(arquivo);
  102.     DOF2_SetString(arquivo2,local,"Apagado pelo Usuário");
  103.     DOF2_SaveFile();
  104.     SendClientMessage(playerid, COR_AMARELO,"Local apagado com sucesso!");
  105.     return 1;
  106. }
  107. CMD:atualizarlocal(playerid, params[])
  108. {
  109.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
  110.     if(sscanf(params, "s[64]", local))  return SendClientMessage(playerid, COR_GRAD,"Use: /atualizarlocal [nome do local]");
  111.     format(arquivo,sizeof(arquivo), "/Locais/%s.ini",local);
  112.     if(!DOF2_FileExists(arquivo))
  113.     {
  114.         SendClientMessage(playerid, COR_GRAD,"Esse Local não esta registrado em nosso Banco de Dados!");
  115.         return 1;
  116.     }
  117.     DOF2_RemoveFile(arquivo);
  118.     DOF2_CreateFile(arquivo);
  119.     GetPlayerPos(playerid, x, y, z);
  120.     DOF2_SetString(arquivo,"Nome",local);
  121.     DOF2_SetFloat(arquivo,"X",x);
  122.     DOF2_SetFloat(arquivo,"Y",y);
  123.     DOF2_SetFloat(arquivo,"Z",z);
  124.     DOF2_SetInt(arquivo,"Interior",GetPlayerInterior(playerid));
  125.     DOF2_SetInt(arquivo,"VirtualWorld",GetPlayerVirtualWorld(playerid));
  126.     DOF2_SaveFile();
  127.     SendClientMessage(playerid, COR_AMARELO,"Local atualizado com sucesso!");
  128.     return 1;
  129. }
  130. CMD:locais(playerid, params[])
  131. {
  132.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_GRAD,"Você não está autorizado a usar este comando.");
  133.     new loc[512];
  134.     if(!DOF2_FileExists("Locais.txt")) DOF2_CreateFile("Locais.txt");
  135.     new File:ftw=fopen("Locais.txt",io_read);
  136.     SendClientMessage(playerid, COR_AMARELO, "==================== LOCAIS ====================");
  137.     new l;
  138.     while(fread(ftw,loc))
  139.     {
  140.         l++;
  141.         if(l==0)
  142.         {
  143.             SendClientMessage(playerid,COR_BRANCO,"Nenhum Local Salvo no Banco de Dados");
  144.         }
  145.         else
  146.         {
  147.             SendClientMessage(playerid,COR_BRANCO,loc);
  148.         }
  149.     }
  150.     fclose(ftw);
  151.     return 1;
  152. }
  153. CMD:creditosteleporte(playerid, params[])
  154. {
  155.     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Creditos do Sistema de Teleportes", "------------- Sistema de Teleportes -------------\n------------- Com Salvamento IN GAME -------------\nCriado por: Marcelodell ou Spark_DaSantos", "OK", "");
  156.     return 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement