Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma tabsize 0
- #include <a_samp>
- #include <zcmd>
- #define MAX_BOMBE 999
- new Bacene[MAX_PLAYERS];
- new Objekt[MAX_PLAYERS], Float: gX, Float: gY, Float: gZ;
- public OnPlayerConnect(playerid)
- {
- Bacene[playerid] = 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new playerState = GetPlayerState(playerid);
- new weaponid, ammo;
- GetPlayerWeaponData(playerid, 8, weaponid, ammo);
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- if(PRESSED(KEY_YES) && (playerState == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER) && Bacene[playerid] == 0 && weaponid == WEAPON_GRENADE && ammo > 0)
- {
- new Float: X, Float: Y, Float: Z;
- GetPlayerPos(playerid, X, Y, Z);
- gX = X, gY = Y-5, gZ = Z;
- Objekt[playerid] = CreateObject(342, gX, gY, gZ, 0.0, 0.0, 0.0, 10.0);
- SetTimer("eksplozija", 900, false);
- Bacene[playerid] = true;
- SendClientMessage(playerid, -1, "Bacio si bombu");
- GivePlayerWeapon(playerid, WEAPON_GRENADE, -1);
- }
- else if(Bacene[playerid] == 1) { return 0;}
- else if(weaponid == WEAPON_GRENADE && ammo == 0) { return 0; }
- return 1;
- }
- forward eksplozija(playerid);
- public eksplozija(playerid)
- {
- CreateExplosion(gX, gY, gZ, 0, 5.0);
- DestroyObject(Objekt[playerid]);
- Bacene[playerid] = false;
- return 1;
- }
- CMD:bomba(playerid, params[]) // test komanda
- {
- GivePlayerWeapon(playerid, WEAPON_GRENADE, 50 );
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment