Advertisement
Guest User

POKEMON SYSTEM by wumpyc

a guest
Oct 26th, 2011
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.65 KB | None | 0 0
  1. #include "a_samp"
  2. #include <zcmd>
  3.  
  4. new Squirtle[MAX_PLAYERS];
  5. new SquirtleTime[MAX_PLAYERS];
  6. new GotATurtle[MAX_PLAYERS];
  7. new PokemonTurtle[MAX_PLAYERS];
  8. new Cow[MAX_PLAYERS];
  9. new CowTime[MAX_PLAYERS];
  10. new GotACow[MAX_PLAYERS];
  11. new PokemonCow[MAX_PLAYERS];
  12. forward Squirtle_I_Choose_Youuuuu(playerid);
  13. public Squirtle_I_Choose_Youuuuu(playerid)
  14. {
  15.         new Float:phrr[4];
  16.         new playerstate = GetPlayerState(playerid);
  17.         if (playerstate == PLAYER_STATE_DRIVER
  18.         || playerstate == PLAYER_STATE_PASSENGER)
  19.         {
  20.         if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  21.         {
  22.         SendClientMessage(playerid, 0xFF0000FF,"Are you crazy?..Turtle can't follow you when you're driving.");
  23.         SendClientMessage(playerid, 0xFF0000FF,"Turtle is in your pokč ball!");
  24.         KillTimer(SquirtleTime[playerid]);
  25.         DestroyObject(Squirtle[playerid]);
  26.         GotATurtle[playerid] = 0;
  27.         }
  28.         }
  29.         if (playerstate == PLAYER_STATE_ONFOOT)
  30.         {
  31.         GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
  32.         GetPlayerFacingAngle(playerid, phrr[3]);
  33.         SetObjectRot(Squirtle[playerid],0.0, 0.0, phrr[3]);
  34.         MoveObject(Squirtle[playerid], phrr[0]-3,phrr[1],phrr[2],10);
  35.         }
  36.         return 1;
  37. }
  38.  
  39. COMMAND:goturtle(playerid,params[])
  40. {
  41.     new Float:x1,Float:y1,Float:z1,Float:a;
  42.     if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  43.     {
  44.     if (GotATurtle[playerid] == 0)
  45.     {
  46.     GetPlayerPos(playerid,x1,y1,z1);
  47.     GetPlayerFacingAngle(playerid, a);
  48.     Squirtle[playerid] = CreateObject(1609,x1,y1,z1-1,a,0.0,0.0);
  49.     SquirtleTime[playerid] = SetTimerEx("Squirtle_I_Choose_Youuuuu",1,true, "i", playerid);
  50.     SendClientMessage(playerid, 0x00FF00FF,"TURTLE I CHOOSE YOUU , GO!");
  51.     SendClientMessage(playerid, 0xFFFF00FF,"Now use /getturtle to get it back to pokč ball!");
  52.     GotATurtle[playerid] = 1;
  53.     }
  54.     else
  55.     {
  56.     SendClientMessage(playerid, 0xFF0000FF,"Are you blind?!?!");
  57.     }
  58.     }
  59.     else
  60.     {
  61.     SendClientMessage(playerid, 0xFF0000FF,"You dont have a turtle!");
  62.     }
  63.     return 1;
  64. }
  65. COMMAND:getturtle(playerid,params[])
  66. {
  67.         if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  68.         {
  69.         if (GotATurtle[playerid] == 1)
  70.         {
  71.         SendClientMessage(playerid, 0xFFFF00FF,"Come back in pokč ball, turtle!");
  72.         KillTimer(SquirtleTime[playerid]);
  73.         DestroyObject(Squirtle[playerid]);
  74.         GotATurtle[playerid] = 0;
  75.         }
  76.         else
  77.         {
  78.         SendClientMessage(playerid, 0xFF0000FF,"First you have to call it from your pokč ball!");
  79.         }
  80.         }
  81.         else
  82.         {
  83.         SendClientMessage(playerid, 0xFF0000FF,"You dont have a turtle!");
  84.         }
  85.         return 1;
  86. }
  87.  
  88.  
  89. public OnPlayerDisconnect(playerid)
  90. {
  91.         KillTimer(SquirtleTime[playerid]);
  92.         GotATurtle[playerid] = 0;
  93.         KillTimer(CowTime[playerid]);
  94.         GotACow[playerid] = 0;
  95.         return 1;
  96. }
  97.  
  98. COMMAND:buyturtle(playerid,params[])
  99. {
  100.         if (IsPlayerAttachedObjectSlotUsed(playerid, 4) == 0)
  101.         {
  102.         SetPlayerAttachedObject(playerid, 4, 1609, 10, 0.0, 0.0,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  103.         SendClientMessage(playerid, 0x00FF00FF,"You have bought a turtle");
  104.         SendClientMessage(playerid, 0x00FF00FF,"Now use /goturtle to call it from pokč ball!");
  105.         GivePlayerMoney(playerid, -20000);
  106.         GotATurtle[playerid] = 0;
  107.         PokemonTurtle[playerid] = 1;
  108.         }
  109.         return 1;
  110. }
  111. COMMAND:sellturtle(playerid,params[])
  112. {
  113.         if(IsPlayerAttachedObjectSlotUsed(playerid,4))
  114.         {
  115.         RemovePlayerAttachedObject(playerid,4);
  116.         DestroyObject(Squirtle[playerid]);
  117.         SendClientMessage(playerid, 0x00FF00FF,"You have sold a turtle");
  118.         GivePlayerMoney(playerid, 19000);
  119.         GotATurtle[playerid] = 0;
  120.         PokemonTurtle[playerid] = 0;
  121.         }
  122.         return 1;
  123. }
  124.  
  125.  forward Cow_I_Choose_Youuuuu(playerid);
  126. public Cow_I_Choose_Youuuuu(playerid)
  127. {
  128.         new Float:phrr[4];
  129.         new playerstate = GetPlayerState(playerid);
  130.         if (playerstate == PLAYER_STATE_DRIVER
  131.         || playerstate == PLAYER_STATE_PASSENGER)
  132.         {
  133.         if(PokemonCow[playerid] == 1)
  134.         {
  135.         SendClientMessage(playerid, 0xFF0000FF,"Are you crazy?..Cow can't follow you when you're driving.");
  136.         SendClientMessage(playerid, 0xFF0000FF,"Cow is in your pokč ball!");
  137.         KillTimer(CowTime[playerid]);
  138.         DestroyObject(Cow[playerid]);
  139.         GotACow[playerid] = 0;
  140.         }
  141.         }
  142.         if (playerstate == PLAYER_STATE_ONFOOT)
  143.         {
  144.         GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
  145.         GetPlayerFacingAngle(playerid, phrr[3]);
  146.         SetObjectRot(Cow[playerid],0.0, 0.0, phrr[3]);
  147.         MoveObject(Cow[playerid], phrr[0]-10,phrr[1],phrr[2],10);
  148.         }
  149.         return 1;
  150. }
  151.  
  152. COMMAND:gocow(playerid,params[])
  153. {
  154.     new Float:x1,Float:y1,Float:z1,Float:a;
  155.     if(PokemonCow[playerid] == 1)
  156.     {
  157.     if (GotACow[playerid] == 0)
  158.     {
  159.     GetPlayerPos(playerid,x1,y1,z1);
  160.     GetPlayerFacingAngle(playerid, a);
  161.     Cow[playerid] = CreateObject(16442,x1-10,y1,z1-1,a,0.0,0.0);
  162.     CowTime[playerid] = SetTimerEx("Cow_I_Choose_Youuuuu",1,true, "i", playerid);
  163.     SendClientMessage(playerid, 0x00FF00FF,"COW I CHOOSE YOUU , GO!");
  164.     SendClientMessage(playerid, 0xFFFF00FF,"Now use /getcow to get it back to pokč ball!");
  165.     GotACow[playerid] = 1;
  166.     }
  167.     else
  168.     {
  169.     SendClientMessage(playerid, 0xFF0000FF,"Are you blind?!?!");
  170.     }
  171.     }
  172.     else
  173.     {
  174.     SendClientMessage(playerid, 0xFF0000FF,"You dont have a cow!");
  175.     }
  176.     return 1;
  177. }
  178. COMMAND:getcow(playerid,params[])
  179. {
  180.         if (PokemonCow[playerid] == 1)
  181.         {
  182.         if (GotACow[playerid] == 1)
  183.         {
  184.         SendClientMessage(playerid, 0xFFFF00FF,"Come back in pokč ball, cow!");
  185.         KillTimer(CowTime[playerid]);
  186.         DestroyObject(Cow[playerid]);
  187.         GotACow[playerid] = 0;
  188.         }
  189.         else
  190.         {
  191.         SendClientMessage(playerid, 0xFF0000FF,"First you have to call it from your pokč ball!");
  192.         }
  193.         }
  194.         else
  195.         {
  196.         SendClientMessage(playerid, 0xFF0000FF,"You dont have a cow!");
  197.         }
  198.         return 1;
  199. }
  200.  
  201.  
  202. COMMAND:buycow(playerid,params[])
  203. {
  204.         if (PokemonCow[playerid] == 0)
  205.         {
  206.         SendClientMessage(playerid, 0x00FF00FF,"You have bought a cow");
  207.         SendClientMessage(playerid, 0x00FF00FF,"Now use /gocow to call it from pokč ball!");
  208.         GivePlayerMoney(playerid, -20000);
  209.         GotACow[playerid] = 0;
  210.         PokemonCow[playerid] = 1;
  211.         }
  212.         return 1;
  213. }
  214. COMMAND:sellcow(playerid,params[])
  215. {
  216.         if(PokemonCow[playerid] == 1)
  217.         {
  218.         DestroyObject(Cow[playerid]);
  219.         SendClientMessage(playerid, 0x00FF00FF,"You have sold a cow");
  220.         GivePlayerMoney(playerid, 19000);
  221.         GotACow[playerid] = 0;
  222.         PokemonCow[playerid] = 0;
  223.         }
  224.         return 1;
  225. }
  226.  
  227.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement