#include "vaultscript.h" #include <cstdio> using namespace std; using namespace vaultmp; Base _9mm = (Base) 0x000E3778; Value spot[] = {-102.76, -398.82, 3458.55}; Value angle[] = {93.0, 134.0}; IDSet player_barrel; Result VAULTSCRIPT BarrelSpot() noexcept { IDVector players = GetList(Type::ID_PLAYER); for (const ID& id : players) { if (!player_barrel.count(id) && IsNearPoint(id, spot[0], spot[1], spot[2], 30.0)) { Value X, Y, Z; GetAngle(id, X, Y, Z); if (Z > angle[0] && Z < angle[1]) { UIMessage(id, "You found a broken 9mm pistol at the bottom of the barrel!"); AddItem(id, _9mm, 1, 0.0, False); player_barrel.insert(id); } } } return (Result) 0; } Void VAULTSCRIPT exec() noexcept { if (GetGameCode() != Index::NEWVEGAS) { printf("BarrelScript is for Fallout: New Vegas only!\n"); terminate(); } CreateTimer(&BarrelSpot, (Interval) 500); printf("BarrelScript for Fallout: New Vegas loaded\n"); } Void VAULTSCRIPT OnPlayerDisconnect(ID player, Reason reason) noexcept { player_barrel.erase(player); } Void VAULTSCRIPT OnSpawn(ID object) noexcept { player_barrel.erase(object); }
#include <vaultmp> #define MAX_PLAYERS (4) new PlayerID[MAX_PLAYERS] = [0,...]; new _9mm = 0x000E3778, Float:spot[] = [-102.76,-398.82,3458.55], Float:angle[] = [93.0,134.0], bool:event[MAX_PLAYERS] = [false,...]; main() { if(GetMaximumPlayers() > MAX_PLAYERS) printf("Error, your MAX_PLAYERS is too low! Required: %d",GetMaximumPlayers()); switch(GetGameCode()) { case NEWVEGAS: { printf("BarrelScript for Fallout: New Vegas loaded\n"); CreateTimer("BarrelSpot",1000); } default: printf("BarrelScript is for Fallout: New Vegas only!\n"); } } public OnPlayerDisconnect(ID, reason) { new conID = GetConnection(ID); event[conID] = false; PlayerID[conID] = 0; } forward BarrelSpot(); public BarrelSpot() { for (new i; i<MAX_PLAYERS; i++) { new ID = PlayerID[i]; if(ID == 0 || event[i]) continue; if(!IsNearPoint(ID,spot[0],spot[1],spot[2],30.0)) continue; new Float:x,Float:y,Float:z; GetAngle(ID,x,y,z); if(z > angle[0] && z < angle[1]) { UIMessage(ID,"You found a broken 9mm pistol at the bottom of the barrel!"); AddItem(ID,_9mm,1,0.0,Bool:false); event[i] = true; } } return 1; }
Contributors: | ,
Created by Last edited by , 09-08-2012 at 05:44 PM 0 Comments, 3,168 Views |
, 04-28-2012 at 11:23 PM