CMD:unbanme(playerid, params[]) { new str[254]; strcat(str,"{2282f7}Cop Unban - 500K\n"); strcat(str,"{ff1ce4}Army Unban - 750K\n"); ShowPlayerDialog(playerid, dUNBAN,DIALOG_STYLE_LIST,"Class unbans",str,"Close","Agree"); return 1; }
new myban;
CMD:unbanme(playerid,params[]) {
new string[128];
if(pData[playerid][CopBanned] == 0 && pData[playerid][ArmyBanned] == 0) return SendClientMessage(playerid, -1, "you are not army / cop banned");
if(pData[playerid][CopBanned] == 1) {
strcat(string,"{2282f7}Cop Unban - 500K\n");
myban ++;
}
if(pData[playerid][ArmyBanned] == 1) {
strcat(str,"{ff1ce4}Army Unban - 750K\n");
if(myban == 0) myban = 2;
myban ++;
}
return ShowPlayerDialog(playerid, dUNBAN,DIALOG_STYLE_LIST,"Class unbans",str,"Close","Agree");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == dUNBAN) {
if(response) {
if(myban == 2) {
switch(listitem) {
case 0: {
new cash = GetPlayerMoney(playerid);
if(cash - 500000 < 0) return SendClientMessage(playerid,-1,"You don't have enough cash");
pData[playerid][CopBanned] = 0;
SendClientMessage(playerid,-1,"Your Cop Ban Has been successfully expired");
}
case 1: {
new cash = GetPlayerMoney(playerid);
if(cash - 750000 < 0) return SendClientMessage(playerid,-1,"You don't have enough cash");
pData[playerid][ArmyBanned] = 0;
SendClientMessage(playerid,-1,"Your army Ban Has been successfully expired");
}
}
if(myban == 3) {
new cash = GetPlayerMoney(playerid);
if(cash - 750000 < 0) return SendClientMessage(playerid,-1,"You don't have enough cash");
pData[playerid][ArmyBanned] = 0;
SendClientMessage(playerid,-1,"Your army Ban Has been successfully expired");
}
if(myban == 1) {
if(cash - 500000 < 0) return SendClientMessage(playerid,-1,"You don't have enough cash");
pData[playerid][CopBanned] = 0;
SendClientMessage(playerid,-1,"Your Cop Ban Has been successfully expired");
}
}
if(!response) SendClientMessage(playerid,-1,"You've succesfully cancled dialog un ban");
myban = 0;
}
return 1;
}
First part of the code works, however the seccond part does not, but yes you got the idea, that is what i was looking for.
|