BigETI

Lancers gate example

May 4th, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.74 KB | None | 0 0
  1. //This example has been made by BigETIĀ©
  2.  
  3. //News
  4. new mygateid, bool:gatestate = false;
  5.  
  6. //Publics
  7. public OnGameModeInit()
  8. {
  9.     //...Your Stuff
  10.     mygate = CreateObject(...); //The variable 'mygate' returns now the Object ID we want.
  11.     return 1;
  12. }
  13.  
  14. public OnPlayerCommandText(playerid, cmdtext[])
  15. {
  16.     //...Your Stuff
  17.     if(!strcmp("/tgate", cmdtext, true))
  18.     {
  19.         switch(gate)
  20.         {
  21.             case false:
  22.             {
  23.                 gatestate = true; //Setting it to true, because we are opening the gate
  24.                 //Example: MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed)
  25.                 //objectid stays for the Object ID which returns your gate (not Model ID!)
  26.                 //Float:X stays for the future X coordinate of your gate.
  27.                 //Float:Y stays for the future Y coordinate of your gate.
  28.                 //Float:Z stays for the future Z coordinate of your gate.
  29.                 //Float:Speed stays for the speed of your gate (amount/sec)
  30.                 MoveObject(mygateid, 791.44879150391, -2304.7546386719, 26.623531341553, 2.0);
  31.                 SendClientMessage(playerid, 0x3333FF, "You have opened the gate.");
  32.             }
  33.             case true:
  34.             {
  35.                 gatestate = false; //Setting it to false because we are closing the gate now.
  36.                 //Example: MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed)
  37.                 //objectid stays for the Object ID which returns your gate (not Model ID!)
  38.                 //Float:X stays now for the old X coordinate of your gate.
  39.                 //Float:Y stays now for the old Y coordinate of your gate.
  40.                 //Float:Z stays now for the old Z coordinate of your gate.
  41.                 //Float:Speed stays for the speed of your gate (amount/sec)
  42.                 MoveObject(mygateid, 787.18463134766, -2295.435546875, 26.623531341553, 2.0);+
  43.                 SendClientMessage(playerid, 0x3333FF, "You have closed the gate.");
  44.             }
  45.         }
  46.         return 1;
  47.     }
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment