Advertisement
Guest User

DropGun(changeCreditsPeteShag)

a guest
May 8th, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.49 KB | None | 0 0
  1. Top Of Script
  2. //--[Weapons]
  3. new Text:WeaponDetails[MAX_PLAYERS];
  4. enum GunDrop
  5. {
  6.   DropGunAmmount[2],
  7.   DropObject,
  8.   Float:DropGunPosX,
  9.   Float:DropGunPosY,
  10.   Float:DropGunPosZ,
  11.   DropGunVirtualWorld,
  12.   DropGunInterior,
  13. };
  14. new GunDropInfo[1000][GunDrop];
  15. new GunObjectIDs[200] ={
  16.   1575, 331, 333, 334, 335, 336, 337, 338, 339, 341, 321, 322, 323, 324, 325, 326, 342, 343, 344, -1,  -1 , -1 ,
  17.   346, 347, 348, 349, 350, 351, 352, 353, 355, 356, 372, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
  18.   368, 369, 1575
  19. };
  20. main()
  21. {
  22.   for(new playerid = 0;playerid < GetMaxPlayers();playerid++){
  23.   //--[Weapon Details]
  24.   WeaponDetails[playerid] = TextDrawCreate(110, 420, "Weapon");
  25.   TextDrawBackgroundColor(WeaponDetails[playerid],0x00000033);
  26.   TextDrawFont(WeaponDetails[playerid],3);
  27.   TextDrawLetterSize(WeaponDetails[playerid],0.399999,1.700000);
  28.   TextDrawColor(WeaponDetails[playerid],0xFFFFFFFF);
  29.   TextDrawSetShadow(WeaponDetails[playerid],3);
  30.  
  31. }
  32. stock DropGun(playerid, GunID, GunAmmo, Float:DX, Float:DY, Float:DZ, world, interior)
  33. {
  34.   new name[MAX_PLAYER_NAME];
  35.   GetPlayerName(playerid,name,sizeof(name));
  36.   if(GunID != 0 && GunAmmo != 0)
  37.   {
  38.     for(new i = 0; i < sizeof(GunDropInfo); i++)
  39.     {
  40.       if(GunDropInfo[i][DropGunPosX] == 0.0 && GunDropInfo[i][DropGunPosY] == 0.0 && GunDropInfo[i][DropGunPosZ] == 0.0)
  41.       {
  42.         GunDropInfo[i][DropGunAmmount][0] = GunID;
  43.         GunDropInfo[i][DropGunAmmount][1] = GunAmmo;
  44.         GunDropInfo[i][DropGunPosX] = DX;
  45.         GunDropInfo[i][DropGunPosY] = DY;
  46.         GunDropInfo[i][DropGunPosZ] = DZ;
  47.         GunDropInfo[i][DropGunVirtualWorld] = world;
  48.         GunDropInfo[i][DropGunInterior] = interior;
  49.         GunDropInfo[i][DropObject] = CreateDynamicObject(GetGunObjectID(GunID), DX, DY, DZ-1, 80.0, 0.0, 0.0, world);
  50.         return 1;
  51.       }
  52.     }
  53.     return 1;
  54.   }
  55.   return 1;
  56. }
  57. stock GetGunObjectID(WeaponID)
  58. {
  59.   if (WeaponID < 0 || WeaponID > 64)
  60.   {
  61.     return 1575;
  62.   }
  63.   return GunObjectIDs[WeaponID];
  64. }
  65. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  66. {
  67.   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  68.   {
  69.  
  70.   }
  71.   else
  72.   {
  73.     for(new i = 0; i < sizeof(GunDropInfo); i++)
  74.     {
  75.       if(IsPlayerInRangeOfPoint(playerid, 1.0,GunDropInfo[i][DropGunPosX],GunDropInfo[i][DropGunPosY],GunDropInfo[i][DropGunPosZ]))
  76.     {
  77.       GameTextForPlayer(playerid,"~w~Pick Up Weapon: ~k~~SNEAK_ABOUT~!",1000,5);
  78.       if(GetPlayerVirtualWorld(playerid) == GunDropInfo[i][DropGunVirtualWorld] && GetPlayerInterior(playerid) == GunDropInfo[i][DropGunInterior])
  79.       {
  80.         if(PRESSED(KEY_WALK))
  81.         {
  82.           DestroyDynamicObject(GunDropInfo[i][DropObject]);
  83.           GunDropInfo[i][DropGunPosX] = 0.0;
  84.           GunDropInfo[i][DropGunPosY] = 0.0;
  85.           GunDropInfo[i][DropGunPosZ] = 0.0;
  86.           GivePlayerWeapon(playerid,GunDropInfo[i][DropGunAmmount][0],GunDropInfo[i][DropGunAmmount][1]);
  87.           return 1;
  88.         }
  89.         return 0;
  90.       }
  91.     }
  92.   }
  93.   return 1;
  94.   }
  95. public OnPlayerUpdate(playerid)
  96. {
  97.   for(new i = 0; i < sizeof(GunDropInfo); i++)
  98.   {
  99.     if(IsPlayerInRangeOfPoint(playerid, 1.0,GunDropInfo[i][DropGunPosX],GunDropInfo[i][DropGunPosY],GunDropInfo[i][DropGunPosZ]))
  100.     {
  101.       new string3[128];
  102.       format(string3,sizeof string3,"~w~Weapon ID:%i Ammo:%i",GunDropInfo[i][DropGunAmmount][0],GunDropInfo[i][DropGunAmmount][1]);
  103.       TextDrawSetString(WeaponDetails[playerid],string3);
  104.       TextDrawShowForPlayer(playerid,WeaponDetails[playerid]);
  105.     }
  106.     else
  107.     {
  108.       TextDrawHideForPlayer(playerid,WeaponDetails[playerid]);
  109.     }
  110.     return 1;
  111.   }
  112.   return 1;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement