Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *@project Wanted labels
- *@author: Atrox <atrox-dev.de>
- *@license: CC BY-NC-SA 3.0 <http://creativecommons.org/licenses/by-nc-sa/3.0/>
- *@date: 01/13/2013
- Don't remove any copyright message without my permission.
- **/
- #include <a_samp>
- #include <streamer> //Incognitos Streamer Plugin
- #define COLOR_LIGHTBLUE 0x00C2ECFF
- enum PInfo
- {
- Text3D: PPlayerLabel[MAX_PLAYERS],
- WantedLevel,
- Logged
- };
- new PlayerInfo[MAX_PLAYERS][PInfo];
- //Use this DeletePlayerWantedLabelFP(playerid); for a cop if he is kicked out of the duty, game, job etc.
- stock DeletePlayerWantedLabelFP(playerid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsValidDynamic3DTextLabel(PlayerInfo[playerid][PPlayerLabel][i]))
- DestroyDynamic3DTextLabel(PlayerInfo[playerid][PPlayerLabel][i]);
- }
- return 1;
- }
- //Use this DeletePlayerWantedLabel(playerid); if you jail a player or if you completely remove his wanteds.
- stock DeletePlayerWantedLabel(playerid)
- {
- //if(PlayerInfo[playerid][WantedLevel] == 0) return 1;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsValidDynamic3DTextLabel(PlayerInfo[i][PPlayerLabel][playerid]))
- DestroyDynamic3DTextLabel(PlayerInfo[i][PPlayerLabel][playerid]);
- }
- return 1;
- }
- //Use this CreatePlayerWantedLabel(playerid); if you give a player wanteds. This function also updates the current wanted number.
- stock CreatePlayerWantedLabel(playerid)
- {
- if(PlayerInfo[playerid][WantedLevel] == 0) return 1;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerCopOrArmy(i))
- {
- if(PlayerInfo[i][Logged] == 0) continue;
- format(string, sizeof(string), "Wanteds: %d", PlayerInfo[playerid][WantedLevel]);
- if(!IsValidDynamic3DTextLabel(PlayerInfo[i][PPlayerLabel][playerid]))
- PlayerInfo[i][PPlayerLabel][playerid] = CreateDynamic3DTextLabel(string, COLOR_LIGHTBLUE, 0.0, 0.0, 0.4, 30.0, playerid, INVALID_VEHICLE_ID, 1, -1, -1, i);
- else
- UpdateDynamic3DTextLabelText(PlayerInfo[i][PPlayerLabel][playerid], COLOR_LIGHTBLUE, string);
- }
- }
- return 1;
- }
- //use this CopCreatePlayerWanteds(playerid); for cops if they start their duty.
- //This function creates the Wanted Labels for cops etc.
- stock CopCreatePlayerWanteds(playerid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i) || PlayerInfo[i][Logged] == 0) continue;
- if(PlayerInfo[i][WantedLevel] > 0)
- {
- format(string, sizeof(string), "Wanteds: %d", PlayerInfo[i][WantedLevel]);
- if(!IsValidDynamic3DTextLabel(PlayerInfo[playerid][PPlayerLabel][i]))
- {
- PlayerInfo[playerid][PPlayerLabel][i] = CreateDynamic3DTextLabel(string, COLOR_LIGHTBLUE, 0.0, 0.0, 0.4, 30.0, i, INVALID_VEHICLE_ID, 1, -1, -1, playerid);
- }
- else
- UpdateDynamic3DTextLabelText(PlayerInfo[playerid][PPlayerLabel][i], COLOR_LIGHTBLUE, string);
- }
- }
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DeletePlayerWantedLabel(playerid);
- DeletePlayerWantedLabelFP(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement