CMD:ads(playerid, params[]) {
return cmd_advertisements(playerid, params);
}
CMD:advertisements(playerid, params[]) {
if(gPlayerLogged{playerid} == 0) {
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
}
else if(GetPVarType(playerid, "Injured")) {
SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements while injured.");
}
else if(PlayerCuffed[playerid] != 0) {
SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements right now.");
}
else if(PlayerInfo[playerid][pJailTime] > 0) {
SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements while in jail.");
}
else ShowPlayerDialog(playerid, DIALOG_ADMAIN, DIALOG_STYLE_LIST, "Advertisements", "List Advertisements\nSearch Advertisements\nPlace Advertisement\nPlace Priority Advertisement", "Select", "Cancel");
return 1;
}
Hello guy,
I have some problem with OnDialogResponse i cant make it and i asked a lot of people to help me with it but no one want to help so i hope today i find any one can help me to make OnDialogResponse for my cmd:ads Ads Commands: PHP код:
Код:
|
CMD:ads(playerid, params[]) { return cmd_advertisements(playerid, params); } CMD:advertisements(playerid, params[]) { if(gPlayerLogged{playerid} == 0) { ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Notice", "You are not logged in", "Close", ""); } else if(GetPVarType(playerid, "Injured")) { ShowPlayerDialog(playerid, 1338, DIALOG_STYLE_MSGBOX, "Notice", "You can't use advertisements while injured", "Close", ""); } else if(PlayerCuffed[playerid] != 0) { ShowPlayerDialog(playerid, 1339, DIALOG_STYLE_MSGBOX, "Notice", "You can't use advertisement right now", "Close", ""); } else if(PlayerInfo[playerid][pJailTime] > 0) { ShowPlayerDialog(playerid, 1340, DIALOG_STYLE_MSGBOX, "Notice", "You can't use advertisements while in jailed, "Close", ""); } else ShowPlayerDialog(playerid, DIALOG_ADMAIN, DIALOG_STYLE_LIST, "Advertisements", "List Advertisements\nSearch Advertisements\nPlace Advertisement\nPlace Priority Advertisement", "Select", "Cancel"); return 1; }
if(dialogid == DIALOG_ADMAIN) { if(response) { switch(listitem) { case 0: { ShowPlayerDialog(playerid, 1441, DIALOG_STYLE_MSGBOX, "List Advertisements", "Change this", "Close", ""); } case 1: { ShowPlayerDialog(playerid, 1442, DIALOG_STYLE_MSGBOX, "Search Advertisements", "Change this", "Close", ""); } case 2: { ShowPlayerDialog(playerid, 1443, DIALOG_STYLE_MSGBOX, "Place Advertisement", "Change this", "Close", ""); } case 3: { ShowPlayerDialog(playerid, 1444, DIALOG_STYLE_MSGBOX, "Place Priority Advertisement", "Change this", "Close", ""); } } } }
Edit im not yet finish just wait |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == your dialog name the one u defined)
{
if(response)
{
if(listitem == 0) // if he clicked the 1st option
{
// what you want to show him
}
if(listitem == 1)
{
// what you want to show him
}
if(listitem == 2)
{
// what you want to show him // u can use case if u want
}
}
return 1;
}
return 0; // return 0 as per samp wiki
}
u lost this code?? |
ShowPlayerDialog(playerid, 1340, DIALOG_STYLE_MSGBOX, "Notice", "You can't use advertisements while in jailed, "Close", ""); |
if(dialogid == DIALOG_ADMAIN) { if(response) { switch(listitem) { case 0: { ShowPlayerDialog(playerid, 1441, DIALOG_STYLE_MSGBOX, "List Advertisements", "Change this", "Close", ""); } case 1: { ShowPlayerDialog(playerid, 1442, DIALOG_STYLE_MSGBOX, "Search Advertisements", "Change this", "Close", ""); } case 2: { ShowPlayerDialog(playerid, 1443, DIALOG_STYLE_MSGBOX, "Place Advertisement", "Change this", "Close", ""); } case 3: { ShowPlayerDialog(playerid, 1444, DIALOG_STYLE_MSGBOX, "Place Priority Advertisement", "Change this", "Close", ""); } } } } |
"Change this", "Close" |