Guest User

G_ObjectsRot

a guest
May 30th, 2010
2,410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. #include <a_samp>
  2. #include <G_ObjectsRot>
  3. #pragma tabsize 0
  4. main()
  5. {
  6. print("\n----------------------------------");
  7. print(" Blank Gamemode by your name here");
  8. print("----------------------------------\n");
  9. }
  10. new bool:open[SERVER_OBJECTS] = false;
  11. public OnGameModeInit()
  12. {
  13. SetGameModeText("Blank Script");
  14. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  15. CreateObject(5004,1124.458,-2557.726,1.848,0.0,0.0,-180.000);
  16. CreateObject(5706,1204.238,-2587.184,4.300,0.0,0.0,90.000);
  17. CreateObject(5706,1204.261,-2545.279,3.700,0.0,0.0,90.000);
  18. CreateObject(5706,1171.207,-2587.926,4.575,0.0,0.0,90.000);
  19. CreateObject(5706,1171.226,-2548.168,4.600,0.0,0.0,90.000);
  20. CreateObject(5706,1139.898,-2592.466,4.525,0.0,0.0,90.000);
  21. CreateObject(5706,1139.885,-2541.601,4.375,0.0,0.0,90.000);
  22. CreateObject(5706,1105.367,-2588.885,4.575,0.0,0.0,90.000);
  23. CreateObject(5706,1105.516,-2542.044,4.175,0.0,0.0,90.000);
  24. CreateObject(969,1213.362,-2561.887,2.250,0.0,0.0,-90.000);
  25. CreateObject(966,1181.317,-2564.452,2.083,0.0,0.0,90.000);
  26. CreateObject(968,1181.324,-2564.428,2.917,0.0,-90.000,90.000);
  27. CreateObject(969,1149.497,-2575.757,2.250,0.0,0.0,-270.000);
  28. CreateObject(969,1149.499,-2558.244,2.250,0.0,0.0,-90.000);
  29. CreateObject(966,1115.511,-2558.384,2.083,0.0,0.0,90.000);
  30. CreateObject(966,1115.512,-2572.663,2.083,0.0,0.0,-90.000);
  31. CreateObject(968,1115.532,-2558.347,2.852,0.0,-90.000,90.000);
  32. CreateObject(968,1115.524,-2572.794,2.842,0.0,-90.000,-90.000);
  33. CreateObject(969,1194.338,-2561.925,8.425,180.000,0.0,-90.000);
  34. CreateObject(969,1194.343,-2561.909,2.075,0.0,0.0,-90.000);
  35. CreateObject(7191,1194.244,-2565.362,10.432,180.000,0.0,0.0);
  36. CreateObject(7191,1194.298,-2572.476,-9.780,90.618,0.0,0.0);
  37. CreateObject(7191,1193.760,-2559.568,-9.730,90.618,0.0,0.0);
  38. CreateObject(968,1075.524,-2557.794,2.842,0.0,-90.000,-90.000);
  39. return 1;
  40. }
  41.  
  42. public OnPlayerRequestClass(playerid, classid)
  43. {
  44. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  45. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  46. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  47. return 1;
  48. }
  49. public OnPlayerCommandText(playerid, cmdtext[])
  50. {
  51. new cmd[256];
  52. new idx;
  53. cmd = strtok(cmdtext, idx);
  54. if(!strcmp(cmd, "/rotate", true))
  55. {
  56. new tmp4[256];
  57. tmp4 = strtok(cmdtext, idx);
  58. new tmp5[256];
  59. tmp5 = strtok(cmdtext, idx);
  60. new tmp6[256];
  61. tmp6 = strtok(cmdtext, idx);
  62. new tmp1[256];
  63. tmp1 = strtok(cmdtext, idx);
  64. new tmp2[256];
  65. tmp2 = strtok(cmdtext, idx);
  66. new tmp3[256];
  67. tmp3 = strtok(cmdtext, idx);
  68. if(!strlen(tmp1)||!strlen(tmp2)||!strlen(tmp3)||!strlen(tmp4)||!strlen(tmp5)||!strlen(tmp6))return SendClientMessage(playerid,0xffffffff,"Use: /rotate [obj] [rotX] [rotY] [rotZ] [Points] [Speed]");
  69. new Float:rot[3];
  70. GetObjectRot(strval(tmp4),rot[0],rot[1],rot[2]);
  71. RotateObject(strval(tmp4),rot[0]+floatstr(tmp5),rot[1]+floatstr(tmp6),rot[2]+floatstr(tmp1),strval(tmp2),floatstr(tmp3));
  72. return 1;
  73. }
  74. if(!strcmp(cmd, "/open", true))
  75. {
  76. new tmp1[256];
  77. tmp1 = strtok(cmdtext, idx);
  78. if(!strlen(tmp1))return SendClientMessage(playerid,0xffffffff,"Usa: /open [1-5]");
  79. new Float:rot[3];
  80. if(strval(tmp1)==1){GetObjectRot(10,rot[0],rot[1],rot[2]);RotateObject(10,rot[0],rot[1],rot[2]-90.0,90,50.0);open[10] = true;}
  81. if(strval(tmp1)==2){GetObjectRot(19,rot[0],rot[1],rot[2]);RotateObject(19,rot[0]-90.0,rot[1],rot[2],90,50.0);GetObjectRot(20,rot[0],rot[1],rot[2]);RotateObject(20,rot[0]+90.0,rot[1],rot[2],90,50.0);open[19] = true;open[20] = true;}
  82. if(strval(tmp1)==3){GetObjectRot(12,rot[0],rot[1],rot[2]);RotateObject(12,rot[0],rot[1]+90.0,rot[2],90,50.0);open[12] = true;}
  83. if(strval(tmp1)==4){GetObjectRot(13,rot[0],rot[1],rot[2]);RotateObject(13,rot[0],rot[1],rot[2]+90.0,90,50.0);GetObjectRot(14,rot[0],rot[1],rot[2]);RotateObject(14,rot[0],rot[1],rot[2]-90.0,90,50.0);open[13] = true;open[14] = true;}
  84. if(strval(tmp1)==5){GetObjectRot(17,rot[0],rot[1],rot[2]);RotateObject(17,rot[0],rot[1]+90.0,rot[2],90,50.0);GetObjectRot(18,rot[0],rot[1],rot[2]);RotateObject(18,rot[0],rot[1]+90.0,rot[2],90,50.0);open[17] = true;open[18] = true;}
  85. return 1;
  86. }
  87. if(!strcmp(cmd, "/bucle", true))
  88. {
  89. new tmp1[256];
  90. tmp1 = strtok(cmdtext, idx);
  91. new tmp2[256];
  92. tmp2 = strtok(cmdtext, idx);
  93. new tmp3[256];
  94. tmp3 = strtok(cmdtext, idx);
  95. new tmp4[256];
  96. tmp4 = strtok(cmdtext, idx);
  97. new tmp5[256];
  98. tmp5 = strtok(cmdtext, idx);
  99. if(!strlen(tmp1)||!strlen(tmp2)||!strlen(tmp3)||!strlen(tmp4)||!strlen(tmp5))return SendClientMessage(playerid,0xffffffff,"Use: /bucle [obj] [offX] [offY] [offZ] [speed]");
  100. GenerateBucle(strval(tmp1),floatstr(tmp2),floatstr(tmp3),floatstr(tmp4),floatstr(tmp5));
  101. return 1;
  102. }
  103. if(!strcmp(cmd, "/stopbucle", true))
  104. {
  105. new tmp1[256];
  106. tmp1 = strtok(cmdtext, idx);
  107. if(!strlen(tmp1))return SendClientMessage(playerid,0xffffffff,"Usa: /bucle [obj]");
  108. StopBucle(strval(tmp1));
  109. return 1;
  110. }
  111. return 0;
  112. }
  113. strtok(const string[], &index)
  114. {
  115. new length = strlen(string);
  116. while ((index < length) && (string[index] <= ' '))
  117. {
  118. index++;
  119. }
  120.  
  121. new offset = index;
  122. new result[20];
  123. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  124. {
  125. result[index - offset] = string[index];
  126. index++;
  127. }
  128. result[index - offset] = EOS;
  129. return result;
  130. }
  131. public OnObjectRotated(objectid)
  132. {
  133. new Float:rot[3];
  134. GetObjectRot(objectid,rot[0],rot[1],rot[2]);
  135. if(objectid == 10 && open[10]){SetTimerEx("ReturnObject",1000,0,"dfffdf",10,rot[0],rot[1],rot[2]+90.0,90,50.0);}
  136. if(objectid == 19 && open[19]){SetTimerEx("ReturnObject",1000,0,"dfffdf",19,rot[0]+90.0,rot[1],rot[2],90,50.0);}
  137. if(objectid == 20 && open[20]){SetTimerEx("ReturnObject",1000,0,"dfffdf",20,rot[0]-90.0,rot[1],rot[2],90,50.0);}
  138. if(objectid == 12 && open[12]){SetTimerEx("ReturnObject",1000,0,"dfffdf",12,rot[0],rot[1]-90.0,rot[2],90,50.0);}
  139. if(objectid == 13 && open[13]){SetTimerEx("ReturnObject",1000,0,"dfffdf",13,rot[0],rot[1],rot[2]-90.0,90,50.0);}
  140. if(objectid == 14 && open[14]){SetTimerEx("ReturnObject",1000,0,"dfffdf",14,rot[0],rot[1],rot[2]+90.0,90,50.0);}
  141. if(objectid == 17 && open[17]){SetTimerEx("ReturnObject",1000,0,"dfffdf",17,rot[0],rot[1]-90.0,rot[2],90,50.0);}
  142. if(objectid == 18 && open[18]){SetTimerEx("ReturnObject",1000,0,"dfffdf",18,rot[0],rot[1]-90.0,rot[2],90,50.0);}
  143. return 1;
  144. }
  145. public OnObjectStopRotate(objectid)
  146. {
  147. return 1;
  148. }
  149. public OnObjectStopBucle(objectid)
  150. {
  151. return 1;
  152. }
  153. forward ReturnObject(objectid,Float:rotx,Float:roty,Float:rotz,points,Float:speed);
  154. public ReturnObject(objectid,Float:rotx,Float:roty,Float:rotz,points,Float:speed)
  155. {
  156. open[objectid] = false;
  157. RotateObject(objectid,rotx,roty,rotz,points,speed);
  158. return 1;
  159. }
Advertisement
Add Comment
Please, Sign In to add comment