Advertisement
Guest User

Goto System -V1.0-Advanced- My First FS - (0.3z compiled)

a guest
May 19th, 2014
1,321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.76 KB | None | 0 0
  1. //ShivRp First Filterscript
  2. //Goto System , V1.0
  3. //This script allows you to teleport to other players provided their name/playerid.
  4. //Do anything with this script.
  5. //I thought this will be helpful for many newbie servers.
  6. //View this script topic here & also about tutorial how i made it!
  7. //You can give me suggestions...
  8. //Do anything other than removing credits! Add it in your gamemode..
  9.  
  10. #define FILTERSCRIPT
  11.  
  12. #include <a_samp>
  13. #include <sscanf2>
  14. #include <zcmd>
  15.  
  16. #if defined FILTERSCRIPT
  17.  
  18. #define Red 0xFF0000FF
  19. #define Yellow 0xFFFF00AA
  20. #define Green 0x33AA33AA
  21.  
  22. //dialog ids...
  23. #define GOTO 99987451
  24.  
  25. //variables
  26. new GotoDisabled[MAX_PLAYERS];
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     print("\nNow Loading ShivRP Goto System V1.0");
  31.     print(" Goto System V1.0 By ShivRp");
  32.     print("Loaded Successfully.\n");
  33.     return 1;
  34. }
  35.  
  36. public OnFilterScriptExit()
  37. {
  38.     print("\nUnloading ShivRP Goto System V1.0");
  39.     print(" Goto System V1.0 By ShivRp");
  40.     print("UnLoaded Successfully.\n");
  41.     return 1;
  42. }
  43.  
  44. #else
  45.  
  46. main()
  47. {
  48.     print("\nNow Loading ShivRP Goto System V1.0");
  49.     print(" Goto System V1.0 By ShivRp");
  50.     print("Loaded Successfully.\n");
  51. }
  52.  
  53. #endif
  54.  
  55. public OnPlayerConnect(playerid)
  56. {
  57. GotoDisabled[playerid] = 0;
  58. SendClientMessage(playerid,Green,"This server is using ShivRp filterscript. Goto System V1.0.");
  59. return 1;
  60. }
  61.  
  62. public OnPlayerDisconnect(playerid, reason)
  63. {
  64. GotoDisabled[playerid] = 0;
  65. return 1;
  66. }
  67.  
  68. CMD:gotocmds(playerid,params[])
  69. {
  70. ShowPlayerDialog(playerid, GOTO, DIALOG_STYLE_MSGBOX, "ShivRp Goto V1 CMDS", "/goto - Teleport to other players\n/tgoto - Toggle goto enable/disable.\n/gotocmds - View all ShivRp Goto CMDS.", "Ok", "");
  71. return 1;
  72. }
  73.  
  74. CMD:tgoto(playerid,params[])//toggle goto. disable/enable.
  75. {
  76.  if(IsPlayerConnected(playerid))
  77.     {
  78.         if(GotoDisabled[playerid] == 1)
  79.         {
  80.             GotoDisabled[playerid] = 0;
  81.             GameTextForPlayer(playerid,"~b~You have ~r~enabled ~b~goto",2000,3);
  82.             SendClientMessage(playerid,Green,"This server is using ShivRp filterscript. Goto System V1.0.");
  83.             return 1;
  84.         }
  85.         else
  86.         {
  87.             GotoDisabled[playerid] = 1;
  88.             GameTextForPlayer(playerid,"~b~You have ~r~disabled ~b~goto",2000,3);
  89.             SendClientMessage(playerid,Green,"This server is using ShivRp filterscript. Goto System V1.0.");
  90.             return 1;
  91.         }
  92.     }
  93. return 1;
  94. }
  95.  
  96. CMD:goto(playerid,params[])//Our main cmd!
  97. {
  98. new ID;
  99.     if(sscanf(params, "u", ID)) return SendClientMessage(playerid, Red, "USAGE: /goto [id/part of nick]");
  100.     else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, Red, "This player is offline or it is yourself");
  101.     if(GotoDisabled[ID] == 1)
  102.     {
  103.         GameTextForPlayer(playerid,"~y~Player has disabled goto!",2000,3);
  104.         return 1;
  105.     }
  106.     else
  107.     {
  108.         new Float:x, Float:y, Float:z;
  109.         new name[MAX_PLAYER_NAME+1],name2[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
  110.         GetPlayerName(playerid, name, sizeof(name));
  111.         GetPlayerName(ID, name2, sizeof(name2));
  112.         GetPlayerPos(ID, x, y, z);
  113.         SetPlayerPos(playerid, x+1, y+1, z+1);
  114.         format(string,sizeof(string),"[INFO]%s has teleported to you (/goto).",name);
  115.         SendClientMessage(ID,Yellow,string);
  116.         format(string,sizeof(string),"[INFO]You have teleported to %s (/goto).",name2);
  117.         SendClientMessage(playerid,Yellow,string);
  118.         PlayerPlaySound(ID, 1150, 0.0, 0.0, 10.0);
  119.         SendClientMessage(playerid,Green,"This server is using ShivRp filterscript. Goto System V1.0.");
  120.         PlayerPlaySound(playerid, 1150, 0.0, 0.0, 10.0);
  121.         SendClientMessage(ID,Green,"This server is using ShivRp filterscript. Goto System V1.0.");
  122.     }
  123. return 1;
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement