Advertisement
Guest User

Shotyoudie

a guest
Feb 20th, 2010
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.77 KB | None | 0 0
  1. /*
  2. =================================
  3. Special Spawn Place By Shotyoudie
  4. =================================
  5. */
  6.  
  7. #define FILTERSCRIPT
  8.  
  9. #include <a_samp>
  10. #include <dini>
  11. #include <dudb>
  12.  
  13. main() {}
  14.  
  15. public OnFilterScriptInit()
  16. {
  17.         print("\n+----------------------------------------+");
  18.     print("|Special spawnplace by Shotyoudie loaded |");
  19.     print("+----------------------------------------+\n");
  20.     return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25.     print("\n+------------------------------------------+");
  26.     print("|Special spawnplace by Shotyoudie unloaded |");
  27.     print("+------------------------------------------+\n");
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerSpawn(playerid)
  32. {
  33.     new spawn[256], pname[24], Float:NewX, Float:NewY, Float:NewZ;
  34.     GetPlayerName(playerid, pname, sizeof(pname));
  35.     format(spawn, sizeof(spawn), "sspawn/%s.spwn", udb_encode(pname));
  36.     if(dini_Exists(spawn) == 1)
  37.       {
  38.            NewX = dini_Float(spawn, "X");
  39.            NewY = dini_Float(spawn, "Y");
  40.            NewZ = dini_Float(spawn, "Z");
  41.            SetPlayerPos(playerid, NewX, NewY, NewZ);
  42.            SendClientMessage(playerid, 0x0000CDAA,"Special spawn place loaded...");
  43.       }
  44.       else
  45.       {
  46.           SendClientMessage(playerid, 0x0000CDAA, "No special spawn place loaded, Your can save one with /savespawnp");
  47.       }
  48.     return 1;
  49. }
  50.  
  51.  
  52. public OnPlayerCommandText(playerid, cmdtext[])
  53. {
  54.      if (strcmp("/savespawnp", cmdtext, true, 10) == 0)
  55.      {
  56.           new make[256], pname[24], Float:LastX, Float:LastY, Float:LastZ;
  57.           GetPlayerName(playerid, pname, sizeof(pname));
  58.           format(make, sizeof(make), "sspawn/%s.spwn", udb_encode(pname));
  59.           dini_Create(make);
  60.           GetPlayerPos(playerid, LastX, LastY, LastZ);
  61.           dini_FloatSet(make, "X", LastX);
  62.           dini_FloatSet(make, "Y", LastY);
  63.           dini_FloatSet(make, "Z", LastZ);
  64.           SendClientMessage(playerid, 0x0000CDAA,"Special spawn place saved!");
  65.           return 1;
  66.      }
  67.      if (strcmp("/gotospawnp", cmdtext, true, 10) == 0)
  68.      {
  69.         new str1[256], pname[24];
  70.     GetPlayerName(playerid, pname, sizeof(pname));
  71.         format(str1, sizeof(str1), "sspawn/%s.spwn", udb_encode(pname));
  72.     if (dini_Exists(str1))
  73.       {
  74.                 new Float:GotoX, Float:GotoY, Float:GotoZ;
  75.                 GotoX = dini_Float(str1, "X");
  76.                 GotoY = dini_Float(str1, "Y");
  77.                 GotoZ = dini_Float(str1, "Z");
  78.                 SetPlayerPos(playerid,GotoX,GotoY,GotoZ);
  79.                 SendClientMessage(playerid, 0x0000CDAA,"Your teleported to your special spawn place");
  80.           }
  81.           else
  82.           {
  83.                 SendClientMessage(playerid, 0x0000CDAA,"ERROR:File not found");
  84.           }
  85.         return 1;
  86.      }
  87. return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement