SA-MP Forums Archive
/unbanme - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /unbanme (/showthread.php?tid=596214)



/unbanme - yvoms - 14.12.2015

Hey guys im trying to make a small system, i have 2 classes ingame,
Cops and army,

You can get banned from the Cop class and the Army class.
It will update the samp.players database and set ArmyBanned or CopBanned to 1.
if its 1, it will prevent you from using the class, only other classes will be playable no leo.

I began to make a dialog, and i wanted to use that to Unban from the cop or armyclass.

Something like..
if a player types /unbanme
it will check if he is army or cop banned, if he is, it should use the DIALOG_STYLE_LIST
Cop Unban - 500k
Army Unban - 750k


If the player is not cop banned, or not army banned it should say nothing.
When the player clicks the text, another dialog should show up where the player accepts, the money gets withdrawn( player needs to have enough) and then update the row in the database.

Would this be doable?


Re: /unbanme - yvoms - 14.12.2015

I've created the command, however im not sure on how i can get the data from my database,
Код:
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;
}
Like armyban = 0 return SendClientMessage(playerid, -1, "you are not army banned"
armyban = 1 ->Take 750k from the players cash -> Update the row in the database to 0.


Re: /unbanme - CrazyChoco - 14.12.2015

I suppose you store his Cop and Army ban in the database right? If so, just download it like you do with the rest of your variables when loading an user account. Use some variables, and then make it detect whether the variable is 1 or 0. Drop a PM if you want to know further. It's actually quite easy.


Re: /unbanme - jlalt - 14.12.2015

show how you're banning them from cop / amry please.


Re: /unbanme - yvoms - 14.12.2015

i currently have no ban / unban command.
but it is being stored in
pData[lookupid][CopBanned] or
pData[lookupid][ArmyBanned]


Re: /unbanme - jlalt - 14.12.2015

this should do the job if I'm not wrong
PHP код:
new myban;
CMD:unbanme(playerid,params[]) {
   new 
string[128];
   if(
pData[playerid][CopBanned] == && 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 == 0myban 2;
     
myban ++;
   }
   return 
ShowPlayerDialog(playeriddUNBAN,DIALOG_STYLE_LIST,"Class unbans",str,"Close","Agree");
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {
   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(!
responseSendClientMessage(playerid,-1,"You've succesfully cancled dialog un ban");
      
myban 0;
   }
   return 
1;




Re: /unbanme - yvoms - 14.12.2015

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.


Re: /unbanme - jlalt - 14.12.2015

Quote:
Originally Posted by yvoms
Посмотреть сообщение
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.
Can you tell me what is bugged there to fix it for you?


Re: /unbanme - yvoms - 14.12.2015

http://prntscr.com/9e5khi

I've tried making it case dUnban:{
instead of If Dialogid==


Re: /unbanme - jlalt - 14.12.2015

Quote:
Originally Posted by yvoms
Посмотреть сообщение
http://prntscr.com/9e5khi

I've tried making it case dUnban:{
instead of If Dialogid==
And you got error? If yes would you post it?