23.09.2018, 21:18
Hello I'm trying to make it so when a player walks through the pickup he receives the weapon.
Код:
new sWeapon[][] = // Weapon ID and Pickup ID 28 TOTAL { { 2,333 }, //WEAPON_GOLFCLUB { 3,334 },//WEAPON_NITESTICK { 5,336 },//WEAPON_BAT { 6,337 },//WEAPON_SHOVEL { 7,338 },//WEAPON_POOLSTICK { 8,339 },//WEAPON_KATANA { 9,341 },//WEAPON_CHAINSAW { 10,321 },//WEAPON_DILDO { 11,324 },//WEAPON_DILDO2 { 16,342 },//WEAPON_GRENADE { 18,344 },//WEAPON_MOLTOV { 22,346 },//WEAPON_COLT45 { 23,347 },//WEAPON_SILENCED { 24,348 },//WEAPON_DEAGLE { 25,349 },//WEAPON_SHOTGUN { 26,350 },//WEAPON_SAWEDOFF { 27,351 },//WEAPON_SHOTGSPAZ12 { 28,352 },//WEAPON_UZI { 29,353 },//WEAPON_MP5 { 30,355 },//WEAPON_AK47 { 31,356 },//WEAPON_M4 { 32,372 },//WEAPON_TEC9 { 33,357 },//WEAPON_RIFLE { 34,358 },//WEAPON_SNIPER { 35,359 },//WEAPON_ROCKETLAUNCHER { 37,361 },//WEAPON_FLAMETHROWER {0, 1279 }, // AMMO {0, 1242 } // BODY ARMOUR }; CreateRandomLoot() { new LootID; for(new i; i < sizeof(SZ1LootSpawns); i++) { LootID = random(TOTAL_LOOT_ITEMS); LootSpawn[i] = CreatePickup(sWeapon[LootID][1],1,SZ1LootSpawns[i][0],SZ1LootSpawns[i][1],SZ1LootSpawns[i][2],0); } return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { for(new i; i < sizeof(LootSpawn); i++) { if(pickupid == LootSpawn[i]) { SendClientMessage(playerid,COLOR_RED,"Pickup weapon"); new WeaponID = sWeapon[LootSpawn[i]][0]; GivePlayerWeapon(playerid,WeaponID,30); printf("Weapon ID: %d",WeaponID); DestroyPickup(LootSpawn[i]); } } return 1; }