Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* **********************************************************
- **********************************************************
- ** **
- ** $$$$$$$$$$$$$$$ **
- ** $$$$$$$$$$$$$$$ **
- ** $$$$ $$$$$$$ $$$$$$$$ $$$$$$$ **
- ** $$$$ $$$$$$$$$ $$$$$$$$$$ $$$$$$$$$ **
- ** $$$$ $$$ $$$ $$$ $$$ **
- ** $$$$ $$$$$$$$ $$$$$$$$$ $$$$$$$$$ **
- ** $$$$ $$$$$$$$ $$$$$$$$$ $$$$$$$$$ **
- ** $$$$ $$$ $$$ $$$ $$$ **
- ** $$$$ $$$$$$$$ $$$$$$$$$ $$$ $$$ **
- ** $$$$ $$$$$$ $$$$$$$ $$$ $$$ **
- ** **
- ** ~ RPG Cidade Virtual TSSA ~ **
- **********************************************************
- ~ [TSSA]Nando ~
- ... E-mail: [email protected] ...
- ... Site: www.tssabr.org ...
- ... IP: cv.tssabr.org:7777 ...
- **********************************************************
- **********************************************************
- native GetObjectModel(objectid);
- native IsPlayerInRangeOfObject(playerid, Float:range, objectid);
- native IsPlayerInRangeOfModelID(playerid, Float:range, modelid);
- native GetRangePlayerObjectID(playerid, Float:range);
- native IsPlayerInRangeOfAnyObject(playerid, Float:range);
- native GetPlayerDistanceToObject(playerid, objectid);
- native CreateExplosionOnObject(objectid, type, Float:radius);
- */
- #include <a_samp>
- #include <dutils>
- enum oInfo
- {
- infoid,
- infomodel,
- Float:infoX,
- Float:infoY,
- Float:infoZ,
- Float:infoDrawD
- };
- new ObjectInfo[MAX_OBJECTS][oInfo];
- Float:GetDistanceToPoint(playerid,Float:x2,Float:y2,Float:z2)
- {
- if (IsPlayerConnected(playerid))
- {
- new Float:x1,Float:y1,Float:z1;
- GetPlayerPos(playerid,x1,y1,z1);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
- return 9999.9;
- }
- stock CreateTSSAObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 300.0)
- {
- new objectid = CreateObject(modelid, X, Y, Z, rX, rY, rZ, DrawDistance);
- ObjectInfo[objectid][infoid] = objectid;
- ObjectInfo[objectid][infomodel] = modelid;
- ObjectInfo[objectid][infoX] = X;
- ObjectInfo[objectid][infoY] = Y;
- ObjectInfo[objectid][infoZ] = Z;
- ObjectInfo[objectid][infoDrawD] = DrawDistance;
- return objectid;
- }
- stock DestroyTSSAObject(objectid)
- {
- DestroyObject(objectid);
- ObjectInfo[objectid][infoid] = -1;
- ObjectInfo[objectid][infomodel] = -1;
- ObjectInfo[objectid][infoX] = 0.0;
- ObjectInfo[objectid][infoY] = 0.0;
- ObjectInfo[objectid][infoZ] = -15.0 + random(5000);
- ObjectInfo[objectid][infoDrawD] = -1;
- return 1;
- }
- stock MoveTSSAObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0)
- {
- MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX, Float:RotY, Float:RotZ);
- ObjectInfo[objectid][infoX] = X;
- ObjectInfo[objectid][infoY] = Y;
- ObjectInfo[objectid][infoZ] = Z;
- return 1;
- }
- stock GetObjectModel(objectid)
- {
- if(!IsValidObject(objectid)) return 0;
- return ObjectInfo[objectid][infomodel];
- }
- stock IsPlayerInRangeOfObject(playerid, Float:range, objectid)
- {
- if(IsValidObject(objectid) && IsPlayerConnected(playerid))
- {
- if(IsPlayerInRangeOfPoint(playerid, range, ObjectInfo[objectid][infoX], ObjectInfo[objectid][infoY], ObjectInfo[objectid][infoZ])) return 1;
- else return 0;
- }
- }
- stock IsPlayerInRangeOfModelID(playerid, Float:range, modelid)
- {
- new FindM = -1;
- for(new I = 0; I < MAX_OBJECTS; I++)
- {
- if(IsValidObject(objectid) && GetObjectModel(I) == modelid)
- {
- if(IsPlayerInRangeOfPoint(playerid, range, ObjectInfo[objectid][infoX], ObjectInfo[objectid][infoY], ObjectInfo[objectid][infoZ])) { AchouM = I; break; }
- }
- }
- return FindM;
- }
- stock IsPlayerInRangeOfAnyObject(playerid, Float:range)
- {
- for(new I = 0; I < MAX_OBJECTS; I++)
- {
- if(ObjectInfo[I][infoid] != 999999) if(IsPlayerInRangeOfPoint(playerid, range, ObjectInfo[I][infoX], ObjectInfo[I][infoY], ObjectInfo[I][infoZ])) return 1;
- }
- return 0;
- }
- stock GetRangePlayerObjectID(playerid, Float:range)
- {
- new objectid = -1;
- for(new I = 0; I < MAX_OBJECTS; I++)
- {
- if(ObjectInfo[I][infoid] != 999999) { if(IsPlayerInRangeOfPoint(playerid, range, ObjectInfo[I][infoX], ObjectInfo[I][infoY], ObjectInfo[I][infoZ])) { objectid = I; break; } }
- }
- return objectid;
- }
- stock GetPlayerDistanceToObject(playerid, objectid)
- {
- new Float:dist = 99999.9;
- if(IsValidObject(objectid) && IsPlayerConnected(playerid)) dist = GetDistanceToPoint(playerid, ObjectInfo[objectid][infoX], ObjectInfo[objectid][infoY], ObjectInfo[objectid][infoZ]);
- return trunc(dist);
- }
- stock CreateExplosionOnObject(objectid, type, Float:radius) CreateExplosion(ObjectInfo[objectid][infoX], ObjectInfo[objectid][infoY], ObjectInfo[objectid][infoZ], type, Float:radius);
- #define ExplodeObject CreateExplosionOnObject
- #define CreateObject CreateTSSAObject
- #define DestroyObject DestroyTSSAObject
- #define MoveObject MoveTSSAObject
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement