Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************\
- ** **
- ** AdminSight v1.0 **
- ** by Gigi_Falcone **
- ** **
- \***************************************/
- /*
- Credits:
- - JernejL = DistanceCameraTargetToLocation
- - CracK = IsPlayerAimingAt
- - Gigi_Falcone = Other
- */
- //=============================[1][ INCLUDES ]==================================
- //==============================================================================
- #include <a_samp>
- //=============================[2][ DEFINITIONS ]===============================
- //==============================================================================
- #define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- //=============================[3][ FORWARDS ]==================================
- //==============================================================================
- forward AdminTimer(playerid);
- //=============================[4][ NEWS ]======================================
- //==============================================================================
- new pAdminDuty[MAX_PLAYERS];
- new pAdminTimerOn[MAX_PLAYERS];
- new pAdminTimer[MAX_PLAYERS];
- new Text:pAdminText[MAX_PLAYERS];
- //=============================[5][ DEFAULT PUBLICS ]===========================
- //==============================================================================
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" AdminSight v1.0 Loaded Sucessfully! ");
- print("--------------------------------------\n");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- pAdminText[i] = TextDrawCreate(497.000000, 99.000000, "~b~Ime Igraca~n~~r~Health:~w~~n~~r~Armour:~w~~n~~r~Weapon:~w~~n~~r~Ammo:");
- TextDrawBackgroundColor(pAdminText[i], 255);
- TextDrawFont(pAdminText[i], 2);
- TextDrawLetterSize(pAdminText[i], 0.310000, 1.100000);
- TextDrawSetShadow(pAdminText[i], 1);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" AdminSight v1.0 UnLoaded Sucessfully! ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- pAdminDuty[playerid] = 0;
- pAdminTimerOn[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(pAdminDuty[playerid] == 1)
- {
- if(pAdminTimerOn[playerid] == 1)
- {
- TextDrawHideForPlayer(playerid,pAdminText[playerid]);
- KillTimer(pAdminTimer[playerid]);
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE))
- {
- if(pAdminDuty[playerid] == 1)
- {
- if(pAdminTimerOn[playerid] == 0)
- {
- pAdminTimerOn[playerid] = 1;
- pAdminTimer[playerid] = SetTimerEx("AdminTimer",200,1,"i",playerid);
- }
- }
- }
- if((oldkeys & KEY_HANDBRAKE) && !(newkeys & KEY_HANDBRAKE))
- {
- if(pAdminDuty[playerid] == 1)
- {
- if(pAdminTimerOn[playerid] == 1)
- {
- pAdminTimerOn[playerid] = 0;
- KillTimer(pAdminTimer[playerid]);
- }
- }
- }
- if(PRESSED(KEY_LOOK_BEHIND))
- {
- if(pAdminDuty[playerid] == 1)
- {
- TextDrawSetString(pAdminText[playerid],"~b~Ime Igraca~w~~n~~r~Health:~w~~n~~r~Armour:~w~~n~~r~Weapon:~w~~n~~r~Ammo:");
- TextDrawShowForPlayer(playerid,pAdminText[playerid]);
- }
- }
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)//beter to use it with your's gm admin system with cmd Adminduty(if you have one)
- {
- if(success)
- {
- new pIP[16];
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- GetPlayerIp(i, pIP, sizeof(pIP));
- if(!strcmp(ip, pIP, true))
- {
- pAdminDuty[i] = 1;
- GivePlayerWeapon(i,34,10);
- }
- }
- }
- return 1;
- }
- //=============================[6][ CUSTOM PUBLICS ]============================
- //==============================================================================
- public AdminTimer(playerid)
- {
- new
- Float:pX,
- Float:pY,
- Float:pZ,
- Float:Hp,
- Float:Armour,
- iGun,
- iAmmo,
- iname[MAX_PLAYER_NAME],
- string[128];
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && i != playerid)
- {
- GetPlayerPos(i,pX,pY,pZ);
- if(IsPlayerAimingAt(playerid,pX,pY,pZ,0.8) == 1)
- {
- GetPlayerName(i,iname,sizeof(iname));
- GetPlayerHealth(i,Hp);
- GetPlayerArmour(i,Armour);
- new iHp = floatround(Hp);
- new iArmour = floatround(Armour);
- /* This way you can use this code to implement it in your gamemode,
- so you can check for player's organization and other stuff ;)
- if(gTeam[i] == 3 || gTeam[i] == 4) orgname = "Civil";
- else if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1) orgname = "Policija";
- else if(PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2) orgname = "FBI";
- else if(PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3) orgname = "Hitna Pomoc";
- format(string,sizeof(string),"~b~%s~n~~r~Org:~w~ %s~n~~r~Health:~w~ %d~n~~r~Armour:~w~ %d~n~~r~Weapon:~w~ %d~n~~r~Ammo:~w~ %d",iname,orgname,iHp,iArmour,iGun,iAmmo);
- */
- format(string,sizeof(string),"~b~%s~n~~r~Health:~w~ %d~n~~r~Armour:~w~ %d~n~~r~Weapon:~w~ %d~n~~r~Ammo:~w~ %d",iname,iHp,iArmour,iGun,iAmmo);
- TextDrawSetString(pAdminText[playerid],string);
- TextDrawShowForPlayer(playerid,pAdminText[playerid]);
- }
- }
- }
- }
- //=============================[7][ COMMANDS ]==================================
- //==============================================================================
- //none, but i suggest to implement this code in your gm with your admin system
- //=============================[8][ STOCKS & OTHER ]============================
- //==============================================================================
- Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
- {
- new Float:TGTDistance;
- TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
- new Float:tmpX, Float:tmpY, Float:tmpZ;
- tmpX = FrX * TGTDistance + CamX;
- tmpY = FrY * TGTDistance + CamY;
- tmpZ = FrZ * TGTDistance + CamZ;
- return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
- }
- stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
- {
- new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
- GetPlayerCameraPos(playerid, cx, cy, cz);
- GetPlayerCameraFrontVector(playerid, fx, fy, fz);
- return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
- }
- //=============================[ END OF FILE ]==================================
- //==============================================================================
- //If you find any bugs, or you have some suggestions, please contact me on Samp Forum, thank you ;)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement