Quiter 99 Odesláno: 11. Březen, 2012 Share Odesláno: 11. Březen, 2012 NPC Inc Tak vytvoril som jednoduchý ale účinný includ. Includ zisťuje či hráč zaútočil na NPC. Ďalej zisťuje či hráč miery na NPC alebo na hráča. Inštalácia : Do zložky Pawno/Include si vložte #include #define PRESKEY(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) forward U1234(); forward OnNPCTakeDamage(npcid,playerid,weaponid); forward OnPlayerTargetNPC(playerid,npcid); forward OnPlayerTargetPlayer(playerid,targetplayer); forward OnNPCInit(); public OnNPCInit() { SetTimer("U1234",100,true); } public U1234() { for(new ID=0;ID { if(IsPlayerConnected(ID)) { new NPC = GetPlayerTargetPlayer(ID); if(NPC != INVALID_PLAYER_ID) { if(IsPlayerNPC(NPC)) { OnPlayerTargetNPC(ID,NPC); new newkeys,lr,ud,oldkeys;GetPlayerKeys(ID,newkeys,ud,lr); if(PRESKEY(KEY_FIRE)) { OnNPCTakeDamage(NPC,ID,GetPlayerWeapon(ID)); } }else{ OnPlayerTargetPlayer(ID,NPC); } } } } } Otvorte si pozn. blok skopírujte doň a uložte ako NpcInc.inc Hore do módu : #include // Odporúčam nad to nadefinovať MAX_PLAYERS !! Do publicu OnGameModeInit() / OnFilterScriptInit() si vložte OnNPCInit(); A niekde do módu si pridajte toto : public OnPlayerTargetPlayer(playerid,targetplayer) { // Ak hráč miery na hráča return true; } public OnPlayerTargetNPC(playerid,npcid) { // Ak hráč miery na NPC return true; } public OnNPCTakeDamage(npcid,playerid,weaponid) { // Ono to vlastne nespôsobi DMG ale zistí či vystrelil na NPC // A hráč musí mieriť aby sa spustil tento public !! // Ak by niekto chcel tak môžem dorobiť DMG ale musel by mi pomôcť ( musel by som zistiť DMG všetkých zbraní ) return true; } Dúfam že sa vám to bude hodiť Link to comment Share on other sites More sharing options...
LYRIcS 88 Odesláno: 13. Březen, 2012 Share Odesláno: 13. Březen, 2012 da sa 7/10 Link to comment Share on other sites More sharing options...
danCo_ 0 Odesláno: 11. Duben, 2012 Share Odesláno: 11. Duben, 2012 pekný 9/10 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now