Advertisement
BigETI

sampshelltest.pwn

Nov 22nd, 2014
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.00 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sampshell>
  3.  
  4. new Shell:PlayerShell[MAX_PLAYERS];
  5.  
  6. main()
  7. {
  8.     print("");
  9.     print("/===========================\\");
  10.     print("| SA:MP Shell Test started! |");
  11.     print("\\===========================/\n");
  12. }
  13.  
  14. public OnGameModeInit()
  15. {
  16.     SetGameModeText("SA:MP Shell Test");
  17.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  18.     return 1;
  19. }
  20.  
  21. public OnGameModeExit()
  22. {
  23.     SHELL::ReleaseAll();
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29.     if(PlayerShell[playerid])
  30.     {
  31.         SHELL::Release(PlayerShell[playerid]);
  32.         PlayerShell[playerid] = Shell:0;
  33.     }
  34. }
  35.  
  36. public OnPlayerRequestClass(playerid, classid)
  37. {
  38.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  39.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  40.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerText(playerid, text[])
  45. {
  46.     return 1;
  47. }
  48.  
  49. public OnPlayerCommandText(playerid, cmdtext[])
  50. {
  51.     if(!strcmp(cmdtext, "/shell", true, 6))
  52.     {
  53.         if(SHELL::IsActive(PlayerShell[playerid])) SendClientMessage(playerid, 0xFF0000FF, "Wait for the shell to proceed...");
  54.         else
  55.         {
  56.             if(strlen(cmdtext) > 7)
  57.             {
  58.                 PlayerShell[playerid] = SHELL::Execute(cmdtext[7]);
  59.                 SendClientMessage(playerid, 0x00FFFFFF, "Shell command executed!");
  60.             }
  61.             else SendClientMessage(playerid, 0xFF0000FF, "Usage: \"/shell <command>\"");
  62.         }
  63.         return 1;
  64.     }
  65.     else if(!strcmp(cmdtext, "/release", true, 5))
  66.     {
  67.         SHELL::Release(PlayerShell[playerid]);
  68.         return 1;
  69.     }
  70.     else if(!strcmp(cmdtext, "/system", true, 7))
  71.     {
  72.         if(strlen(cmdtext) > 8) SHELL::System(cmdtext[8]);
  73.         else SendClientMessage(playerid, 0xFF0000FF, "Usage: \"/system <command>\"");
  74.         return 1;
  75.     }
  76.     return 0;
  77. }
  78.  
  79. public OnReceiveShellMessage(Shell:handle, msg[])
  80. {
  81.     printf("Shell handle: 0x%x", _:handle);
  82.     print(msg);
  83.     //SendClientMessageToAll(0xFF0000FF, msg);
  84. }
  85.  
  86. public OnReleaseShell(Shell:handle)
  87. {
  88.     printf("Shell handle 0x%x released!", _:handle);
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement