Advertisement
Guest User

Luby

a guest
Mar 11th, 2009
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.79 KB | None | 0 0
  1. /*
  2.  * Map System by Luby & Gamer_Z
  3.  * saved 11 March 2009, 12:09
  4.  */
  5.  
  6. #include <a_samp>
  7.  
  8. new PlrObj[200];
  9. new Lampy[8];
  10. new Datas[3];
  11. new Mury[6];
  12.  
  13. public OnFilterScriptInit(){
  14.     print("\nMap System by Luby and Gamer_Z - Loaded");
  15.     Datas[0] = CreateObject(16662, 1932.2740,-2409.6987,1200.6908, 0.0, 0.0, -27.0);
  16.     Mury[0] = CreateObject(3983, 1930.715088, -2417.489990, 1201.556519, 0.0000, 0.0000, 0.0000);
  17.     Mury[1] = CreateObject(3983, 1938.750122, -2419.424561, 1201.557129, 0.0000, 268.0403, 0.0000);
  18.     Mury[2] = CreateObject(3983, 1922.684082, -2417.233643, 1201.763428, 0.0000, 96.1526, 9.4538);
  19.     Mury[3] = CreateObject(3983, 1932.634888, -2426.096436, 1201.592285, 0.0000, 96.1526, 98.8352);
  20.     Mury[4] = CreateObject(3983, 1934.155273, -2406.747803, 1201.625122, 0.0000, 254.1853, 98.8352);
  21.     Mury[5] = CreateObject(3983, 1938.325562, -2415.805176, 1216.350342, 359.1406, 179.4143, 95.3974);
  22.     Lampy[0] = CreateObject(1232, 1934.736694, -2413.839844, 1202.169678, 0.0000, 0.0000, 0.0000);
  23.     Lampy[1] = CreateObject(1232, 1935.306519, -2421.486816, 1202.169678, 0.0000, 0.0000, 0.0000);
  24.     Lampy[2] = CreateObject(1232, 1928.441406, -2421.002441, 1202.218506, 0.0000, 0.0000, 0.0000);
  25.     Lampy[3] = CreateObject(1232, 1927.940186, -2413.950928, 1202.244629, 0.0000, 0.0000, 0.0000);
  26.     Lampy[4] = CreateObject(1232, 1922.012695, -2430.574951, 1202.355225, 0.0000, 53.2850, 55.8633);
  27.     Lampy[5] = CreateObject(1232, 1942.271362, -2427.741211, 1201.987061, 0.0000, 53.2850, 138.3693);
  28.     Lampy[6] = CreateObject(1232, 1941.111938, -2403.214844, 1201.988281, 0.0000, 53.2850, 237.2046);
  29.     Lampy[7] = CreateObject(1232, 1918.437500, -2406.737793, 1201.562622, 0.0000, 53.2850, 321.4290);
  30.     Datas[1] = SetTimer("UpdateMap", 100, true);
  31.     Datas[2] = SetTimer("Refresh", 2000, true);
  32.     for(new g=0;g<200;g++)if(IsPlayerConnected(g))PlrObj[g] = CreateObject(1234, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  33.     return true;
  34. }
  35.  
  36. public OnFilterScriptExit(){
  37.     print("\nMap System by Luby and Gamer_Z - Unloaded");
  38.     KillTimer(Datas[1]);
  39.     KillTimer(Datas[2]);
  40.     DestroyObject(Datas[0]);
  41.     DestroyObject(Lampy[0]);
  42.     DestroyObject(Lampy[1]);
  43.     DestroyObject(Lampy[2]);
  44.     DestroyObject(Lampy[3]);
  45.     DestroyObject(Lampy[4]);
  46.     DestroyObject(Lampy[5]);
  47.     DestroyObject(Lampy[6]);
  48.     DestroyObject(Lampy[7]);
  49.     DestroyObject(Mury[0]);
  50.     DestroyObject(Mury[1]);
  51.     DestroyObject(Mury[2]);
  52.     DestroyObject(Mury[3]);
  53.     DestroyObject(Mury[4]);
  54.     DestroyObject(Mury[5]);
  55.     for(new g=0;g<200;g++)if(PlrObj[g])DestroyObject(PlrObj[g]);
  56.     return true;
  57. }
  58.  
  59. forward Refresh();
  60. public Refresh(){
  61.     new id;
  62.     new Float:X, Float:Y, Float:Z, Float:R1, Float:R2, Float:R3;
  63.     for(new g=0;g<GetMaxPlayers();g++)if(IsPlayerConnected(g)){
  64.         GetObjectPos(PlrObj[g], X, Y, Z);
  65.         GetObjectRot(PlrObj[g], R1, R2, R3);
  66.         id = CreateObject(1234, X, Y, Z, R1, R2, R3);
  67.         DestroyObject(PlrObj[g]);
  68.         PlrObj[g] = id;
  69.     }
  70.     id = CreateObject(1232, 1934.736694, -2413.839844, 1202.169678, 0.0000, 0.0000, 0.0000);
  71.     DestroyObject(Lampy[0]);
  72.     Lampy[0] = id;
  73.     id = CreateObject(1232, 1935.306519, -2421.486816, 1202.169678, 0.0000, 0.0000, 0.0000); //
  74.     DestroyObject(Lampy[1]);
  75.     Lampy[1] = id;
  76.     id = CreateObject(1232, 1928.441406, -2421.002441, 1202.218506, 0.0000, 0.0000, 0.0000); //
  77.     DestroyObject(Lampy[2]);
  78.     Lampy[2] = id;
  79.     id = CreateObject(1232, 1927.940186, -2413.950928, 1202.244629, 0.0000, 0.0000, 0.0000); //
  80.     DestroyObject(Lampy[3]);
  81.     Lampy[3] = id;
  82.     id = CreateObject(1232, 1922.012695, -2430.574951, 1202.355225, 0.0000, 53.2850, 55.8633); //
  83.     DestroyObject(Lampy[4]);
  84.     Lampy[4] = id;
  85.     id = CreateObject(1232, 1942.271362, -2427.741211, 1201.987061, 0.0000, 53.2850, 138.3693); //
  86.     DestroyObject(Lampy[5]);
  87.     Lampy[5] = id;
  88.     id = CreateObject(1232, 1941.111938, -2403.214844, 1201.988281, 0.0000, 53.2850, 237.2046); //
  89.     DestroyObject(Lampy[6]);
  90.     Lampy[6] = id;
  91.     id = CreateObject(1232, 1918.437500, -2406.737793, 1201.562622, 0.0000, 53.2850, 321.4290); //
  92.     DestroyObject(Lampy[7]);
  93.     Lampy[7] = id;
  94. }
  95.  
  96. forward UpdateMap();
  97. public UpdateMap(){
  98.     new Float:X, Float:Y, Float:Z, Float:R1, Float:R2, Float:R3;
  99.     new Float:DirX, Float:DirY, Float:DirZ;
  100.     new Float:Distance, Float:Angle;
  101.     for(new g=0;g<GetMaxPlayers();g++)if(IsPlayerConnected(g)){
  102.         GetPlayerPos(g, X, Y, Z);
  103.         DirX = 1931.7674;
  104.         DirY = -2417.5302;
  105.         DirZ = 1200.0000;
  106.         DirX = floatadd(DirX, floatmul(floatdiv(X, 3000.0), 1.7062));
  107.         DirY = floatadd(DirY, floatmul(floatdiv(Y, 3000.0), 1.7577));
  108.         DirZ = floatadd(DirZ, floatmul(Z, 0.001));
  109.         GetObjectPos(PlrObj[g], X, Y, Z);
  110.         Distance = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,DirX)),2),floatpower(floatabs(floatsub(Y,DirY)),2)),floatpower(floatabs(floatsub(Z,DirZ)),2)));
  111.         if(IsPlayerInAnyVehicle(g)){
  112.             GetVehicleZAngle(GetPlayerVehicleID(g), Angle);
  113.         } else GetPlayerFacingAngle(g, Angle);
  114.         GetObjectRot(PlrObj[g], R1, R2, R3);
  115.         SetObjectRot(PlrObj[g], 0.0, 0.0, floatdiv(R3 + ((Angle+180.0)*50),51));
  116.         MoveObject(PlrObj[g], DirX, DirY, DirZ, Distance);
  117.     }
  118. }
  119.  
  120. public OnPlayerConnect(playerid)
  121. {
  122.     PlrObj[playerid] = CreateObject(1234, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  123.     return true;
  124. }
  125.  
  126. public OnPlayerDisconnect(playerid) {
  127.     DestroyObject(PlrObj[playerid]);
  128.     return true;
  129. }
  130.  
  131. public OnPlayerCommandText(playerid, cmdtext[]){
  132.     if (!strcmp(cmdtext, "/map", true))
  133.     {
  134.         SetPlayerPos(playerid, 1932.2740,-2409.6987,1202.6908);
  135.         return true;
  136.     }
  137.     if (!strcmp(cmdtext, "/mapon", true))
  138.     {
  139.         SetPlayerCameraPos(playerid, 1931.7674, -2417.5302, 1205.6908);
  140.         TogglePlayerControllable(playerid, false);
  141.         SetPlayerPos(playerid, 1931.7674, -2417.5302, 1207.6908);
  142.         SetPlayerCameraLookAt(playerid, 1931.7674, -2417.5202, 1200.6908);
  143.         return true;
  144.     }
  145.     if (!strcmp(cmdtext, "/mapoff", true))
  146.     {
  147.         TogglePlayerControllable(playerid, true);
  148.         SpawnPlayer(playerid);
  149.         return true;
  150.     }
  151.     return false;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement