Posts: 455
Threads: 83
Joined: Nov 2009
Reputation:
0
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?
Posts: 1,266
Threads: 6
Joined: Oct 2014
show how you're banning them from cop / amry please.
Posts: 455
Threads: 83
Joined: Nov 2009
Reputation:
0
i currently have no ban / unban command.
but it is being stored in
pData[lookupid][CopBanned] or
pData[lookupid][ArmyBanned]
Posts: 1,266
Threads: 6
Joined: Oct 2014
this should do the job if I'm not wrong
PHP код:
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;
}
Posts: 455
Threads: 83
Joined: Nov 2009
Reputation:
0
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.
Posts: 1,266
Threads: 6
Joined: Oct 2014
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?
Posts: 1,266
Threads: 6
Joined: Oct 2014
Quote:
Originally Posted by yvoms
|
And you got error? If yes would you post it?