Advertisement
Guest User

Squirtle (Turtle) by wumpyc

a guest
Oct 22nd, 2011
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.47 KB | None | 0 0
  1. #include "a_samp"
  2. #include <zcmd>
  3.  
  4. new Squirtle[MAX_PLAYERS];
  5. new SquirtleTime[MAX_PLAYERS];
  6.  
  7. forward Squirtle_I_Choose_Youuuuu(playerid);
  8. public Squirtle_I_Choose_Youuuuu(playerid)
  9. {
  10.     new Float:phrr[4];
  11.     new playerstate = GetPlayerState(playerid);
  12.     if (playerstate == PLAYER_STATE_DRIVER
  13.     || playerstate == PLAYER_STATE_PASSENGER)
  14.     {
  15.     GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
  16.     GetPlayerFacingAngle(playerid, phrr[3]);
  17.     SetObjectRot(Squirtle[playerid],0.0, 0.0, phrr[3]);
  18.     MoveObject(Squirtle[playerid], phrr[0]+0.5,phrr[1],phrr[2],10000);
  19.     }
  20.     if (playerstate == PLAYER_STATE_ONFOOT)
  21.     {
  22.     GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
  23.     GetPlayerFacingAngle(playerid, phrr[3]);
  24.     SetObjectRot(Squirtle[playerid],0.0, 0.0, phrr[3]);
  25.     MoveObject(Squirtle[playerid], phrr[0]+0.5,phrr[1],phrr[2],10);
  26.     }
  27.     return 1;
  28. }
  29.  
  30. COMMAND:goturtle(playerid,params[])
  31. {
  32.     new Float:x1,Float:y1,Float:z1,Float:a;
  33.     if( GetPlayerScore(playerid) >= 1000)
  34.     {
  35.     if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  36.     {
  37.         GetPlayerPos(playerid,x1,y1,z1);
  38.         GetPlayerFacingAngle(playerid, a);
  39.         Squirtle[playerid] = CreateObject(1609,x1,y1,z1-1,a,0.0,0.0);
  40.         SquirtleTime[playerid] = SetTimerEx("Squirtle_I_Choose_Youuuuu",1000,true, "i", playerid);
  41.         SendClientMessage(playerid, 0x00FF00FF,"TURTLE I CHOOSE YOUU , GO!");
  42.         SendClientMessage(playerid, 0xFFFF00FF,"Now use /getturtle to get it back");
  43.     }
  44.     }
  45.     return 1;
  46. }
  47. COMMAND:getturtle(playerid,params[])
  48. {
  49.     if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  50.     {
  51.     SendClientMessage(playerid, 0x00FF00FF,"COME BACK, TURTLE!");
  52.     KillTimer(SquirtleTime[playerid]);
  53.     DestroyObject(Squirtle[playerid]);
  54.     }
  55.     return 1;
  56. }
  57.  
  58.  
  59. public OnPlayerDisconnect(playerid)
  60. {
  61.     KillTimer(SquirtleTime[playerid]);
  62.     return 1;
  63. }
  64.  
  65. COMMAND:buyturtle(playerid,params[])
  66. {
  67.     if (IsPlayerAttachedObjectSlotUsed(playerid, 4) == 0)
  68.     {
  69.     SetPlayerAttachedObject(playerid, 4, 1609, 10, 0.0, 0.0,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  70.     SendClientMessage(playerid, 0x00FF00FF,"You have bought turtle");
  71.     SendClientMessage(playerid, 0x00FF00FF,"Now use /goturtle to call it!");
  72.     GivePlayerMoney(playerid, -20000);
  73.     }
  74.     return 1;
  75. }
  76. COMMAND:sellturtle(playerid,params[])
  77. {
  78.     if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  79.     {
  80.     RemovePlayerAttachedObject(playerid,4);
  81.     DestroyObject(Squirtle[playerid]);
  82.     SendClientMessage(playerid, 0x00FF00FF,"You have sold turtle");
  83.     GivePlayerMoney(playerid, 19000);
  84.     }
  85.     return 1;
  86. }
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement