giveplayerid = ReturnUser(playerid, tmp); |
dcmd_crimes(playerid, params[]) { #pragma unused params if (PlayerInfo[playerid][pSpawn] == 1){ if (PlayerInfo[playerid][pTeam] == TEAM_CIVILIAN){ new string[256],Wanted[128],idx,giveplayerid,tmp[256]; tmp = strtok(params, idx); if(!strlen(tmp)) { //SendClientMessage(playerid, COLOR_ERROR, "USAGE: /crimes (Name/Id)."); //return 1; giveplayerid = playerid; }else{ if(!isNumeric(tmp)) { giveplayerid = ReturnUser(playerid, tmp); if(giveplayerid == INVALID_PLAYER_ID) { return 1; } } else { giveplayerid = strval(tmp); if(!IsPlayerConnected(giveplayerid)) { format(string, sizeof(string), "%d Is Not A Valid ID.", giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } } } switch (PlayerInfo[giveplayerid][pWantedLevel]) { case 0:format(string, sizeof(string), "Wated Level %d - Innocent Civilian",PlayerInfo[giveplayerid][pWantedLevel]); case 1..5:format(string, sizeof(string), "~y~Wated Level %d",PlayerInfo[giveplayerid][pWantedLevel]); case 6..10:format(string, sizeof(string), "~r~Wated Level %d",PlayerInfo[giveplayerid][pWantedLevel]); } strmid(Wanted, string, 0, strlen(string), 256); if(PlayerCrimeListRowNo[giveplayerid] > 0) { TextDrawHideForPlayer(playerid, Menu_Title[playerid]); TextDrawHideForPlayer(playerid, Menu_Stats[playerid]); TextDrawHideForPlayer(playerid, Menu_End[playerid]); for(new r = 0; r < MAX_TEXTDRAW_ROWS; r++) { TextDrawHideForPlayer(playerid, Menu_Column1[playerid][r]); TextDrawHideForPlayer(playerid, Menu_Column2[playerid][r]); } ShowTextDrawMenu(playerid, TD_MENU_INFO,"~g~Crime History", PlayerCrimeListRowNo[giveplayerid] + 5, 0); //ShowTextDrawMenuItems(playerid, 0, " ", " ", " ",0); format(string, sizeof(string), "%s (%d)~n~%s",PlayerInfo[giveplayerid][pName],giveplayerid,Wanted); ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0); ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0); ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0); ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0); //ShowTextDrawMenuItems(playerid, 3, " ", Line[0], LineEx[0],0); ShowTextDrawMenuItems(playerid, 4, " ", PlayerCrimeList[playerid][1], " ",0); ShowTextDrawMenuItems(playerid, 5, " ", PlayerCrimeList[playerid][2], " ",0); ShowTextDrawMenuItems(playerid, 6, " ", PlayerCrimeList[playerid][3], " ",0); ShowTextDrawMenuItems(playerid, 7, " ", PlayerCrimeList[playerid][4], " ",0); ShowTextDrawMenuItems(playerid, 8, " ", PlayerCrimeList[playerid][5], " ",0); ShowTextDrawMenuItems(playerid, 9, " ", PlayerCrimeList[playerid][6], " ",0); ShowTextDrawMenuItems(playerid, 10, " ", PlayerCrimeList[playerid][7], " ",0); ShowTextDrawMenuItems(playerid, 11, " ", PlayerCrimeList[playerid][8], " ",0); ShowTextDrawMenuItems(playerid, 12, " ", PlayerCrimeList[playerid][9], " ",0); }else{ format(string, sizeof(string), "No Crimes Committed By %s (%d).",PlayerInfo[giveplayerid][pName],giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); } }else{ SendClientMessage(playerid, COLOR_ERROR, "Only Civilians Can Use This Command."); } }else{ SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead."); } return 1; } |
ReturnUser(text[]) { |
CMD:crimes(playerid, params[])
{
if (PlayerInfo[playerid][pSpawn] != 1) return SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
if (PlayerInfo[playerid][pTeam] != TEAM_CIVILIAN) return SendClientMessage(playerid, COLOR_ERROR, "Only Civilians Can Use This Command.");
new giveplayerid;
if (isnull(params)) giveplayerid = playerid;
else if (!sscanf(params, "r", giveplayerid))
{
if (giveplayerid == INVALID_PLAYER_ID)
{
new string[23];
format(string, sizeof(string), "%d Is Not A Valid ID.", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
}
new string[100];
switch (PlayerInfo[giveplayerid][pWantedLevel])
{
case 0: format(string, sizeof(string), "Wated Level %d - Innocent Civilian", PlayerInfo[giveplayerid][pWantedLevel]);
case 1 .. 5: format(string, sizeof(string), "~y~Wated Level %d", PlayerInfo[giveplayerid][pWantedLevel]);
case 6 .. 10: format(string, sizeof(string), "~r~Wated Level %d", PlayerInfo[giveplayerid][pWantedLevel]);
}
if(PlayerCrimeListRowNo[giveplayerid] > 0)
{
TextDrawHideForPlayer(playerid, Menu_Title[playerid]);
TextDrawHideForPlayer(playerid, Menu_Stats[playerid]);
TextDrawHideForPlayer(playerid, Menu_End[playerid]);
for(new r = 0; r < MAX_TEXTDRAW_ROWS; r++)
{
TextDrawHideForPlayer(playerid, Menu_Column1[playerid][r]);
TextDrawHideForPlayer(playerid, Menu_Column2[playerid][r]);
}
ShowTextDrawMenu(playerid, TD_MENU_INFO,"~g~Crime History", PlayerCrimeListRowNo[giveplayerid] + 5, 0);
//ShowTextDrawMenuItems(playerid, 0, " ", " ", " ",0);
format(string, sizeof(string), "%s (%d)~n~%s", PlayerInfo[giveplayerid][pName], giveplayerid, string);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
//ShowTextDrawMenuItems(playerid, 3, " ", Line[0], LineEx[0],0);
ShowTextDrawMenuItems(playerid, 4, " ", PlayerCrimeList[playerid][1], " ", 0);
ShowTextDrawMenuItems(playerid, 5, " ", PlayerCrimeList[playerid][2], " ", 0);
ShowTextDrawMenuItems(playerid, 6, " ", PlayerCrimeList[playerid][3], " ", 0);
ShowTextDrawMenuItems(playerid, 7, " ", PlayerCrimeList[playerid][4], " ", 0);
ShowTextDrawMenuItems(playerid, 8, " ", PlayerCrimeList[playerid][5], " ", 0);
ShowTextDrawMenuItems(playerid, 9, " ", PlayerCrimeList[playerid][6], " ", 0);
ShowTextDrawMenuItems(playerid, 10, " ", PlayerCrimeList[playerid][7], " ", 0);
ShowTextDrawMenuItems(playerid, 11, " ", PlayerCrimeList[playerid][8], " ", 0);
ShowTextDrawMenuItems(playerid, 12, " ", PlayerCrimeList[playerid][9], " ", 0);
}
else
{
format(string, sizeof(string), "No Crimes Committed By %s (%d).", PlayerInfo[giveplayerid][pName], giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
}
return 1;
}