Guest User

Mobile Spawn System

a guest
Oct 11th, 2010
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.23 KB | None | 0 0
  1. // This filterscript is copyright to Chaosnz
  2. // You are free to edit this filterscript but please DO NOT remove the credits.
  3.  
  4. #include <a_samp>
  5.  
  6.  
  7. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  8.  
  9. #define COLOR_GREY 0xAFAFAFAA
  10.  
  11. new MobSpawn[MAX_PLAYERS];
  12.  
  13. new deathobject;
  14.  
  15. new Float: storX, Float: storY, Float: storZ, Float: storA, Float: storI;
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print("\n--------------------------------------");
  20.     print(" Mobile Spawn System by Chaosnz");
  21.     print("--------------------------------------\n");
  22.     return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27.     return 1;
  28. }
  29.  
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33.     MobSpawn[playerid] = 0;
  34.     SendClientMessage(playerid,COLOR_GREY,"This Server is using the Mobile Spawn System by Chaosnz. /mshelp");
  35.     return 1;
  36. }
  37.  
  38.  
  39. public OnPlayerSpawn(playerid)
  40. {
  41.     if(MobSpawn[playerid] == 1)
  42.     {
  43.         SetPlayerPos(playerid, storX, storY, storZ);
  44.         SetPlayerFacingAngle(playerid,storA);
  45.         SetPlayerInterior(playerid,storI);
  46.         SendClientMessage(playerid,COLOR_GREY,"You have spawned at your Mobile Spawn Point");
  47.     }
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerDeath(playerid, killerid, reason)
  52. {
  53.     SendClientMessage(playerid,COLOR_GREY,"Did you know, you can place a Mobile Spawn Point? /mshelp");
  54.     return 1;
  55. }
  56.  
  57.  
  58.  
  59. public OnPlayerCommandText(playerid, cmdtext[])
  60. {
  61.     dcmd(mshelp,6, cmdtext);
  62.     dcmd(mspawn,6, cmdtext);
  63.     dcmd(gotomsp,7,cmdtext);
  64.     dcmd(removems,8,cmdtext);
  65.     return 0;
  66. }
  67.  
  68.  
  69.  
  70. dcmd_mshelp(playerid, params[])
  71. {
  72.     #pragma unused params
  73.     SendClientMessage(playerid,COLOR_GREY,"Mobile Spawn Help");
  74.     SendClientMessage(playerid,COLOR_GREY,"With this command you can set up your OWN spawnpoint anywhere on the map.");
  75.     SendClientMessage(playerid,COLOR_GREY,"To do this, type /mspawn to spawn where you want");
  76.     SendClientMessage(playerid,COLOR_GREY,"When you type the above command, you will see a object marking your spawn position.");
  77.     SendClientMessage(playerid,COLOR_GREY,"To remove the mobile spawn, type /removems");
  78.     SendClientMessage(playerid,COLOR_GREY,"You can goto your Mobile Spawn Point by typing /gotomsp");
  79.     return 1;
  80. }
  81.  
  82. dcmd_mspawn(playerid, params[])
  83. {
  84.     #pragma unused params
  85.     SendClientMessage(playerid,COLOR_GREY,"Mobile Spawn Placed");
  86.     GetPlayerPos(playerid, storX, storY, storZ);
  87.     GetPlayerFacingAngle(playerid, storA);
  88.     storI = GetPlayerInterior(playerid);
  89.     deathobject = CreateObject(2976, storX, storY, storZ+1,0,0,0,500);
  90.     MobSpawn[playerid] = 1;
  91.     return 1;
  92. }
  93.  
  94. dcmd_removems(playerid, params[])
  95. {
  96.     #pragma unused params
  97.     SendClientMessage(playerid,COLOR_GREY,"Mobile Spawn Disabled");
  98.     DestroyObject(deathobject);
  99.     MobSpawn[playerid] = 0;
  100.     return 1;
  101. }
  102.  
  103. dcmd_gotomsp(playerid, params[])
  104. {
  105.     #pragma unused params
  106.     if(MobSpawn[playerid] == 1)
  107.     {
  108.     SendClientMessage(playerid,COLOR_GREY,"You have teleported to your Mobile Spawn.");
  109.     SetPlayerPos(playerid, storX, storY, storZ);
  110.     SetPlayerFacingAngle(playerid, storA);
  111.     SetPlayerInterior(playerid, storI);
  112.     }
  113.     else
  114.     {
  115.     SendClientMessage(playerid,COLOR_GREY,"You need to create your Mobile Spawn first. /mspawn");
  116.     }
  117.     return 1;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment