Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <izcmd>
- #define INVALID_WEAPON 0
- #define MAX_WEAPON_SLOTS 13
- #define MAX_WEAPONS 47
- /////////////////////////////////////////////////////////////////////////////////
- static pWeaponData[MAX_PLAYERS][MAX_WEAPON_SLOTS];
- static pAmmoData[MAX_PLAYERS][MAX_WEAPON_SLOTS];
- static pAmmoWarns[MAX_PLAYERS];
- static const WeaponSlot[MAX_WEAPONS] =
- {
- 0,0,1,1,1,1,1,1,1,1,10,10,10,10,10,10,8,8,8,-1,-1,-1,2,2,2,3,3,3,4,4,5,5,4,6,6,7,7,7,7,8,12,9,9,9,11,11,11
- };
- /////////////////////////////////////////////////////////////////////////////////
- stock ac_SetPlayerAmmo(playerid,weaponslot,ammo)
- {
- pAmmoData[playerid][weaponslot] = ammo;
- return SetPlayerAmmo(playerid,weaponslot,ammo);
- }
- #if defined _ALS_SetPlayerAmmo
- #undef SetPlayerAmmo
- #else
- #define _ALS_SetPlayerAmmo
- #endif
- #define SetPlayerAmmo ac_SetPlayerAmmo
- stock ac_GivePlayerWeapon(playerid,weaponid,ammo)
- {
- pWeaponData[playerid][WeaponSlot[weaponid]] = weaponid;
- pAmmoData[playerid][WeaponSlot[weaponid]] = GetPlayerAmmo(playerid) + ammo;
- return GivePlayerWeapon(playerid,weaponid,ammo);
- }
- #if defined _ALS_GivePlayerWeapon
- #undef GivePlayerWeapon
- #else
- #define _ALS_GivePlayerWeapon
- #endif
- #define GivePlayerWeapon ac_GivePlayerWeapon
- stock ac_ResetPlayerWeapons(playerid)
- {
- for(new i = 0; i < MAX_WEAPON_SLOTS;i++)
- {
- pWeaponData[playerid][i] = INVALID_WEAPON;
- pAmmoData[playerid][i] = 0;
- }
- return ResetPlayerWeapons(playerid);
- }
- #if defined _ALS_ResetPlayerWeapons
- #undef ResetPlayerWeapons
- #else
- #define _ALS_ResetPlayerWeapons
- #endif
- #define ResetPlayerWeapons ac_ResetPlayerWeapons
- /////////////////////////////////////////////////////////////////////////////////
- forward WeaponCheck();
- public WeaponCheck()
- {
- static wid;
- for(new playerid = 0; playerid <= GetMaxPlayers(); playerid++)
- {
- wid = GetPlayerWeapon(playerid);
- if(wid == -1) continue; //INVALID WEAPON
- switch(GetPlayerState(playerid))
- {
- case PLAYER_STATE_NONE,PLAYER_STATE_WASTED,PLAYER_STATE_SPAWNED: continue;
- }
- if(pWeaponData[playerid][WeaponSlot[wid]] != wid)
- {
- new str[144],name[24],wname[24];
- GetPlayerName(playerid,name,sizeof(name));
- GetWeaponName(wid,wname,sizeof(wname));
- format(str,256,"%s(%d) suspected to be using Weapon Hacks (Weapon Name:%s)",name,playerid,wname);
- SendClientMessageToAll(-1,str);
- }
- if(pAmmoData[playerid][WeaponSlot[wid]] < GetPlayerAmmo(playerid))
- {
- if(++pAmmoWarns[playerid] == 3)
- {
- pAmmoWarns[playerid] = 0;
- new str[144],name[24],wname[24];
- GetPlayerName(playerid,name,sizeof(name));
- GetWeaponName(wid,wname,sizeof(wname));
- format(str,256,"%s(%d) suspected to be using Ammo Hacks (Weapon Name:%s)",name,playerid,wname);
- SendClientMessageToAll(-1,str);
- }
- }
- else pAmmoWarns[playerid] = 0;
- pAmmoData[playerid][WeaponSlot[wid]] = GetPlayerAmmo(playerid);
- continue;
- }
- }
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- SendClientMessageToAll(-1,"Ammo Fired");
- pAmmoData[playerid][WeaponSlot[weaponid]]--;
- return 1;
- }
- /////////////////////////////////////////////////////////////////////////////////
- main()
- {
- }
- public OnGameModeInit()
- {
- SetGameModeText("asdasdasd");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- SetTimer("WeaponCheck",1000,true);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- pAmmoWarns[playerid] = 0;
- ResetPlayerWeapons(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,28,100);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment