Advertisement
Guest User

bare script mod for testing trailer

a guest
Feb 9th, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.58 KB | None | 0 0
  1. #include <a_samp>
  2. #include <core>
  3. #include <float>
  4.  
  5. forward GetTruchHealth();
  6.  
  7. #pragma tabsize 0
  8.  
  9. new trailerready = 0;
  10. new trailerid = -1;
  11. new checkcounter = 0;
  12.  
  13.  
  14. main()
  15. {
  16.     print("\n----------------------------------");
  17.     print("  Bare Script\n");
  18.     print("----------------------------------\n");
  19. }
  20.  
  21. public GetTruchHealth()
  22. {
  23. if(!trailerready) {return 1;}
  24. new Float:health, tmp[128];
  25. GetVehicleHealth(trailerid, health);
  26. checkcounter++;
  27. format(tmp,sizeof(tmp),"[%d] Trailer Health = %.2f", checkcounter, health);
  28. return SendClientMessageToAll(0xFFFFFFFF, tmp);
  29. }
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33.     GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39.     new idx;
  40.     new cmd[256];
  41.    
  42.     cmd = strtok(cmdtext, idx);
  43.  
  44.     if(strcmp(cmd, "/trailertest", true) == 0) {
  45.    
  46.     new Float:X, Float:Y, Float:Z;
  47.     GetPlayerPos(playerid,X,Y,Z);
  48.     GivePlayerWeapon(playerid, 38, 8000);
  49.     trailerid = AddStaticVehicleEx(584,X + 20,Y,Z + 2,0.000,-1,-1,180);
  50.     AddStaticVehicleEx(515,X + 10,Y,Z + 2,0.000,-1,-1,180);
  51.     trailerready = 1;
  52.     return 1;
  53.     }
  54.  
  55.     return 0;
  56. }
  57.  
  58.  
  59. public OnPlayerSpawn(playerid)
  60. {
  61.     SetPlayerInterior(playerid,0);
  62.     TogglePlayerClock(playerid,0);
  63.     return 1;
  64. }
  65.  
  66. public OnPlayerDeath(playerid, killerid, reason)
  67. {
  68.     return 1;
  69. }
  70.  
  71. SetupPlayerForClassSelection(playerid)
  72. {
  73.     SetPlayerInterior(playerid,14);
  74.     SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  75.     SetPlayerFacingAngle(playerid, 270.0);
  76.     SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  77.     SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  78. }
  79.  
  80. public OnPlayerRequestClass(playerid, classid)
  81. {
  82.     SetupPlayerForClassSelection(playerid);
  83.     return 1;
  84. }
  85.  
  86. public OnGameModeInit()
  87. {
  88.     SetGameModeText("Bare Script");
  89.     ShowPlayerMarkers(1);
  90.     ShowNameTags(1);
  91.     AllowAdminTeleport(1);
  92.  
  93.     AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
  94.  
  95.     SetTimer("GetTruchHealth",1000,1);
  96.  
  97.     return 1;
  98. }
  99.  
  100. public OnVehicleDeath(vehicleid, killerid)
  101. {
  102. new tmp[128];
  103. format(tmp,sizeof(tmp),"Vehicle DEAD - vehicleid = %d | killerid = %d", vehicleid, killerid );
  104. SendClientMessageToAll(0xFFFFFFFF, tmp);
  105. return 1;
  106. }
  107.  
  108. strtok(const string[], &index)
  109. {
  110.     new length = strlen(string);
  111.     while ((index < length) && (string[index] <= ' '))
  112.     {
  113.         index++;
  114.     }
  115.  
  116.     new offset = index;
  117.     new result[20];
  118.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  119.     {
  120.         result[index - offset] = string[index];
  121.         index++;
  122.     }
  123.     result[index - offset] = EOS;
  124.     return result;
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement