new PlayerWeapon[MAX_PLAYERS];public OnPlayerUpdate(playerid){new weap = GetPlayerWeapon(playerid);if(PlayerWeapon[playerid] != weap){new str[144 + 1];PlayerWeapon[playerid] = weap;format(str, sizeof(str), \"Kaptál egy %s típusú fegyvert.\", WeaponNames[weap]);SendClientMessage(playerid, -1, str);}}
new WeaponNames[][32] = {{\"Ököl\"}, // 0{\"Boxer\"}, // 1{\"Golf\"}, // 2{\"Stick\"}, // 3{\"Kés\"}, // 4{\"Baseball\"}, // 5{\"Shovel\"}, // 6{\"Pool\"}, // 7{\"Katana\"}, // 8{\"Láncfűrész\"}, // 9{\"PurpleDildo\"}, // 10{\"BigWhiteVibrator\"}, // 11{\"MediumWhiteVibrator\"}, // 12{\"SmallWhiteVibrator\"}, // 13{\"Virág\"}, // 14{\"Cane\"}, // 15{\"Gránát\"}, // 16{\"Teargas\"}, // 17{\"Molotov\"}, // 18{\" \"}, // 19{\" \"}, // 20{\" \"}, // 21{\"Colt45\"}, // 22{\"SilencedColt45\"}, // 23{\"Deagle\"}, // 24{\"Shotgun\"}, // 25{\"Sawnoff\"}, // 26{\"Combat\"}, // 27{\"Uzi\"}, // 28{\"MP5\"}, // 29{\"AK47\"}, // 30{\"M4\"}, // 31{\"Tec9\"}, // 32{\"Rifle\"}, // 33{\"Sniper\"}, // 34{\"Rocket\"}, // 35{\"HRocket\"}, // 36{\"Flamethrower\"}, // 37{\"Minigun\"}, // 38{\"Satchel\"}, // 39{\"Detonator\"}, // 40{\"Spray\"}, // 41{\"Fire\"}, // 42{\"Camera\"}, // 43{\"NightVision\"}, // 44{\"InfraredVision\"}, // 45{\"Parachute\"}, // 46{\"FakePistol\"} // 47};
public OnPlayerUpdate(playerid){new wid, wammo;for(new w = 0; w < 13; w++){ GetPlayerWeaponData(playerid, w, wid, wammo); if(wid != 0 && wammo != 0) { Msg(playerid, \"Kaptál egy fegyvert.\"); }} return 1;}
new WeaponNames[][32] = {{\"Ököl\"}, // 0{\"Boxer\"}, // 1{\"Golf\"}, // 2{\"Stick\"}, // 3{\"Kés\"}, // 4{\"Baseball\"}, // 5{\"Shovel\"}, // 6{\"Pool\"}, // 7{\"Katana\"}, // 8{\"Láncfűrész\"}, // 9{\"PurpleDildo\"}, // 10{\"BigWhiteVibrator\"}, // 11{\"MediumWhiteVibrator\"}, // 12{\"SmallWhiteVibrator\"}, // 13{\"Virág\"}, // 14{\"Cane\"}, // 15{\"Gránát\"}, // 16{\"Teargas\"}, // 17{\"Molotov\"}, // 18{\" \"}, // 19{\" \"}, // 20{\" \"}, // 21{\"Colt45\"}, // 22{\"SilencedColt45\"}, // 23{\"Deagle\"}, // 24{\"Shotgun\"}, // 25{\"Sawnoff\"}, // 26{\"Combat\"}, // 27{\"Uzi\"}, // 28{\"MP5\"}, // 29{\"AK47\"}, // 30{\"M4\"}, // 31{\"Tec9\"}, // 32{\"Rifle\"}, // 33{\"Sniper\"}, // 34{\"Rocket\"}, // 35{\"HRocket\"}, // 36{\"Flamethrower\"}, // 37{\"Minigun\"}, // 38{\"Satchel\"}, // 39{\"Detonator\"}, // 40{\"Spray\"}, // 41{\"Fire\"}, // 42{\"Camera\"}, // 43{\"NightVision\"}, // 44{\"InfraredVision\"}, // 45{\"Parachute\"}, // 46{\"FakePistol\"} // 47};stock FegyverAdas(playerid,weaponid,ammo){GivePlayerWeapon(playerid,weaponid,ammo);new uzenet[64];format(uzenet,sizeof(uzenet),\"Kaptál egy %s -et %d lőszerrel\",WeaponNames[weaponid],ammo);SendClientMessage(playerid,-1,uzenet);return 1;}
FegyverAdas(playerid,31,100);
stock GivePlayerWeaponEx(playerid, weaponid, ammo) {new tempVar[2];GetPlayerWeaponData(playerid, GetWeaponSlot(weaponid), tempVar[0], tempVar[1]);if(tempVar[0]==0&&tempVar[1]==0) {SendClientMessage(playerid, -1, #Kaptál egy fegyvert!);}}#if defined _ALS_GivePlayerWeapon#undef GivePlayerWeapon#else#define _ALS_GivePlayerWeapon#endif#define GivePlayerWeapon GivePlayerWeaponEx
#include <a_samp>// Vedd figyelembe, hogy az OnPlayerUpdate mp-ént kb. 30x fut le, szval nem kellene túlterhelni.. így se a legjobb..#define WEAPON_CHECK_INTERVAL 2500 // milliszekundumban van megadva (1s = 1000ms), ez 2.5 mp..new WeaponsChecked[MAX_PLAYERS], WeaponData[MAX_PLAYERS][13];forward OnPlayerReceiveWeapon(playerid, slot, weaponid, ammo);// Ezt bármelyik szkriptedbe beteheted csak előtte forward-old, ahogy fenn is látodpublic OnPlayerReceiveWeapon(playerid, slot, weaponid, ammo) {new formatstring[128];format(formatstring, 128, \"NEW WEAPON! SLOT: %d | ID: %d | AMMO: %d\", slot, weaponid, ammo);SendClientMessage(playerid, 0x00aa00ff, formatstring);return 1;}public OnPlayerDisconnect(playerid, reason) {WeaponData[playerid] = {0,0,0,0,0,0,0,0,0,0,0,0,0};return 1;}public OnPlayerUpdate(playerid){if (GetTickCount() - WeaponsChecked[playerid] > WEAPON_CHECK_INTERVAL) { for (new slot = 0; slot <= 12; slot++) { new weapon, ammo; GetPlayerWeaponData(playerid, slot, weapon, ammo); if (weapon != WeaponData[playerid][slot]) { CallRemoteFunction(\"OnPlayerReceiveWeapon\", \"iiii\", playerid, slot, weapon, ammo); WeaponData[playerid][slot] = weapon; }}WeaponsChecked[playerid] = GetTickCount();}return 1;}