Created
June 16, 2020 22:28
-
-
Save abdalmoez/3d9697772ded58b36d63632ae3a6df64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMD:listbugs(playerid, params[]) | |
{ | |
if(GetFactionType(playerid) != FACTION_FEDERAL) | |
{ | |
SendClientMessage(playerid, COLOR_GREY, "You can't use this command as you aren't a federal agent."); | |
return 1; | |
} | |
SendClientMessage(playerid, COLOR_GREEN, "Online Bugged players:"); | |
foreach(new i : Player) | |
{ | |
if(PlayerData[i][pBugged]) | |
{ | |
//SendClientMessageEx(playerid, COLOR_GREY, "Name: %s - Placed by: %s - Location: %s", GetRPName(i), PlayerData[i][pBuggedBy], GetPlayerZoneName(i)); | |
SendClientMessageEx(playerid, COLOR_GREY, "Name: %s - Placed by: %s", GetRPName(i), PlayerData[i][pBuggedBy]); | |
} | |
} | |
return 1; | |
} | |
CMD:olistbugs(playerid, params[]) | |
{ | |
if(GetFactionType(playerid) != FACTION_FEDERAL) | |
{ | |
SendClientMessage(playerid, COLOR_GREY, "You can't use this command as you aren't a federal agent."); | |
return 1; | |
} | |
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "SELECT username,buggedby FROM "#TABLE_USERS" WHERE bugged = 1"); | |
mysql_tquery(connectionID, queryBuffer, "OnPlayerSelectAllBugged", "i", playerid); | |
return 1; | |
} | |
forward OnPlayerSelectAllBugged(playerid); | |
public OnPlayerSelectAllBugged(playerid) | |
{ | |
new rows = cache_get_row_count(connectionID); | |
new username[MAX_PLAYER_NAME], | |
buggedby[MAX_PLAYER_NAME]; | |
SendClientMessage(playerid, COLOR_GREEN, "All Bugged players:"); | |
for (new i = 0; i < rows; i ++) | |
{ | |
cache_get_field_content(i, "username", username); | |
cache_get_field_content(i, "buggedby", buggedby); | |
SendClientMessageEx(playerid, COLOR_GREY, "Name: %s - Placed by: %s", username, buggedby); | |
} | |
} | |
CMD:bug(playerid, params[]) | |
{ | |
if(GetFactionType(playerid) != FACTION_FEDERAL) | |
{ | |
return SendClientMessage(playerid, COLOR_GREY, "You are not a federal agent."); | |
} | |
if(!PlayerData[playerid][pToggleBug]) | |
{ | |
return SendClientMessage(playerid, COLOR_GREY, "Enable the bug channel first! (/tog bugged)"); | |
} | |
new | |
targetid; | |
if(sscanf(params, "u", targetid)) | |
{ | |
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bug [playerid]"); | |
} | |
if(PlayerData[targetid][pAdminDuty]) | |
{ | |
return SendClientMessage(playerid, COLOR_GREY, "You can't place bugs on admins."); | |
} | |
if(PlayerData[targetid][pBugged] == 1) | |
{ | |
PlayerData[targetid][pBugged] = 0; | |
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE "#TABLE_USERS" SET bugged = 0, buggedby='' WHERE uid = %i", PlayerData[targetid][pID]); | |
mysql_tquery(connectionID, queryBuffer); | |
SendClientMessageEx(playerid, COLOR_GREY, "The bug on %s has been disabled.", GetRPName(targetid)); | |
} | |
else if(IsPlayerInRangeOfPlayer(playerid, targetid, 4.0)) | |
{ | |
PlayerData[targetid][pBugged] = 1; | |
strcpy(PlayerData[targetid][pBuggedBy], GetRPName(playerid),MAX_PLAYER_NAME); | |
SendClientMessageEx(playerid, COLOR_GREY ,"You have placed a bug on %s.",GetRPName(targetid)); | |
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE "#TABLE_USERS" SET bugged = 1, buggedby='%s' WHERE uid = %i", PlayerData[targetid][pBuggedBy], PlayerData[targetid][pID]); | |
mysql_tquery(connectionID, queryBuffer); | |
} | |
else | |
{ | |
SendClientMessage(playerid, COLOR_GREY, "You need to be closer to that person."); | |
return 1; | |
} | |
return 1; | |
} | |
CMD:clearbugs (playerid, params[]) | |
{ | |
if(GetFactionType(playerid) != FACTION_FEDERAL) | |
{ | |
return SendClientMessage(playerid, COLOR_GREY, "[!] You are not a federal agent."); | |
} | |
if(PlayerData[playerid][pFactionRank] < 4) | |
{ | |
return SendClientMessage(playerid, COLOR_GREY, "[!] You are not a allowed to use this command."); | |
} | |
foreach(new i : Player) | |
{ | |
PlayerData[i][pBugged] = 0; | |
} | |
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE "#TABLE_USERS" SET bugged = 0, buggedby=''"); | |
mysql_tquery(connectionID, queryBuffer); | |
SendClientMessage(playerid, COLOR_GREY, "All bugs has been cleared."); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment