Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new sendername[MAX_PLAYER_NAME];
- new string[128];
- // Crash Bug Fix
- if(strfind(inputtext, "%", true) != -1)
- {
- SendClientMessageEx(playerid, COLOR_GREY, "Invalid Character, please try again.");
- return 1;
- }
- if(dialogid == WELCOMEMAT)
- {
- if(response)
- {
- SendClientMessage(playerid,0x008000FF, "___PART 1____");
- SendClientMessage(playerid,0x008000FF, "Buy a car using your car voucher which is refunded to you.");
- CP[playerid] = 1;
- SetPlayerCheckpoint(playerid, 1647.2083, -1895.2522 ,13.5527, 3.0);
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000FF, "Follow the rules and respect each other. Have a nice stay.");
- }
- }
- if(RegistrationStep[playerid] != 0)
- {
- if(dialogid == REGISTERSEX)
- {
- if(response)
- {
- if(listitem == 0)
- {
- PlayerInfo[playerid][pSex] = 1;
- SendClientMessageEx(playerid, COLOR_YELLOW2, "Alright, so you're a male.");
- ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
- RegistrationStep[playerid] = 2;
- }
- else
- {
- PlayerInfo[playerid][pSex] = 2;
- SendClientMessageEx(playerid, COLOR_YELLOW2, "Alright, so you're a female.");
- ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
- RegistrationStep[playerid] = 2;
- }
- }
- else ShowPlayerDialog(playerid, REGISTERSEX, DIALOG_STYLE_LIST, "{FF0000}Is your character male or female?", "Male\nFemale", "Submit", "");
- }
- }
- if(RegistrationStep[playerid] != 0 || strcmp(PlayerInfo[playerid][pBirthDate], "0000-00-00", true) == 0)
- {
- if(dialogid == REGISTERMONTH)
- {
- if(response)
- {
- new month = listitem+1;
- SetPVarInt(playerid, "RegisterMonth", month);
- new lastdate, stringdiag[410];
- if(listitem == 0 || listitem == 2 || listitem == 4 || listitem == 6 || listitem == 7 || listitem == 9 || listitem == 11) lastdate = 32;
- else if(listitem == 3 || listitem == 5 || listitem == 8 || listitem == 10) lastdate = 31;
- else lastdate = 29;
- for(new x = 1; x < lastdate; x++)
- {
- format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
- }
- ShowPlayerDialog(playerid, REGISTERDAY, DIALOG_STYLE_LIST, "{FF0000}Which day was your character born?", stringdiag, "Submit", "");
- }
- else ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
- }
- else if(dialogid == REGISTERDAY)
- {
- if(response)
- {
- new setday = listitem+1;
- SetPVarInt(playerid, "RegisterDay", setday);
- new month, day, year, stringdiag[600];
- getdate(year,month,day);
- new startyear = year-100;
- for(new x = startyear; x < year; x++)
- {
- format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
- }
- ShowPlayerDialog(playerid, REGISTERYEAR, DIALOG_STYLE_LIST, "{FF0000}Which year was your character born?", stringdiag, "Submit", "");
- }
- else ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
- }
- else if(dialogid == REGISTERYEAR)
- {
- new month, day, year, stringdiag[600];
- getdate(year,month,day);
- new startyear = year-100;
- if(response)
- {
- new setyear = listitem+startyear;
- format(PlayerInfo[playerid][pBirthDate], 11, "%d-%02d-%02d", setyear, GetPVarInt(playerid, "RegisterMonth"), GetPVarInt(playerid, "RegisterDay"));
- DeletePVar(playerid, "RegisterMonth");
- DeletePVar(playerid, "RegisterDay");
- if(RegistrationStep[playerid] != 0)
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Referral System", "Have you been referred to our server by one of our players?\nIf so, please enter the player name below.\n\nIf you haven't been referred by anyone, you may press the skip button.\n\n{FF0000}Note: You must enter the player name with a underscore (Example: FirstName_LastName)", "Enter", "Skip");
- }
- else return SendClientMessageEx(playerid, COLOR_LIGHTRED, "Your birthdate has been successfully set.");
- }
- else
- {
- for(new x = startyear; x < year; x++)
- {
- format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
- }
- ShowPlayerDialog(playerid, REGISTERYEAR, DIALOG_STYLE_LIST, "{FF0000}Which year was your character born?", stringdiag, "Submit", "");
- }
- }
- else if(dialogid == REGISTERREF)
- {
- if(response)
- {
- if(IsNumeric(inputtext))
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
- return 1;
- }
- if(strfind(inputtext, "_", true) == -1)
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
- return 1;
- }
- if(strlen(inputtext) > 20)
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That name is too long\nPlease shorten the name.\n\nExample: FirstName_LastName (20 Characters Max)", "Enter", "Skip");
- return 1;
- }
- if(strcmp(inputtext, GetPlayerNameExt(playerid), true) == 0)
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error", "You can't add yourself as a referrer.\nPlease enter the referrer name or press 'Skip'.\n\nExample: FirstName_LastName (20 Characters Max)", "Enter", "Skip");
- return 1;
- }
- for(new sz = 0; sz < strlen(inputtext); sz++)
- {
- if(inputtext[sz] == ' ')
- {
- ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
- return 1;
- }
- }
- new
- szQuery[128], szEscape[MAX_PLAYER_NAME];
- mysql_escape_string(inputtext, szEscape);
- format(PlayerInfo[playerid][pReferredBy], MAX_PLAYER_NAME, "%s", szEscape);
- format(szQuery, sizeof(szQuery), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", szEscape);
- mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "iii", MAIN_REFERRAL_THREAD, playerid, g_arrQueryHandle{playerid});
- }
- else {
- format(string, sizeof(string), "Nobody");
- strmid(PlayerInfo[playerid][pReferredBy], string, 0, strlen(string), MAX_PLAYER_NAME);
- SendClientMessageEx(playerid, COLOR_LIGHTRED, "Thanks for filling in all the information, now you can proceed to the tutorial!");
- RegistrationStep[playerid] = 3;
- SetPlayerVirtualWorld(playerid, 0);
- ClearChatbox(playerid);
- TutStep[playerid] = 24;
- TextDrawShowForPlayer(playerid, txtNationSelHelper);
- TextDrawShowForPlayer(playerid, txtNationSelMain);
- PlayerNationSelection[playerid] = -1;
- // Streamer_UpdateEx(playerid, 1607.0160,-1510.8218,207.4438);
- // SetPlayerPos(playerid, 1607.0160,-1510.8218,-10.0);
- // SetPlayerCameraPos(playerid, 1850.1813,-1765.7552,81.9271);
- // SetPlayerCameraLookAt(playerid, 1607.0160,-1510.8218,207.4438);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- Streamer_UpdateEx(playerid,1716.1129,-1880.0715,22.0264);
- SetPlayerPos(playerid,1716.1129,-1880.0715,-10.0);
- SetPlayerCameraPos(playerid,1755.0413,-1824.8710,20.2100);
- SetPlayerCameraLookAt(playerid,1716.1129,-1880.0715,22.0264);
- return 1;
- }
- }
- }
- switch(dialogid)
- {
- // BEGIN DYNAMIC GROUP CODE
- case G_LOCKER_MAIN: if(response)
- {
- new iGroupID = PlayerInfo[playerid][pMember];
- switch(listitem)
- {
- case 0:
- {
- if(PlayerInfo[playerid][pDuty]==0)
- {
- if (IsAReporter(playerid) || IsATaxiDriver(playerid))
- format(string, sizeof(string), "* %s %s takes a badge from their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
- else
- format(string, sizeof(string), "* %s %s takes a badge and a gun from their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetPlayerHealth(playerid, 100.0);
- if(IsAMedic(playerid))
- {
- Medics += 1;
- }
- if(arrGroupData[iGroupID][g_iLockerStock] > 1 && arrGroupData[iGroupID][g_iLockerCostType] == 0)
- {
- SetPlayerArmor(playerid, 100);
- arrGroupData[iGroupID][g_iLockerStock] -= 1;
- new str[128], file[32];
- format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of 1 HG Material.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
- new month, day, year;
- getdate(year,month,day);
- format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
- Log(file, str);
- }
- else if(arrGroupData[iGroupID][g_iLockerCostType] != 0)
- {
- SetPlayerArmor(playerid, 100.0);
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_RED, "The locker doesn't have the stock for your armor vest.");
- SendClientMessageEx(playerid, COLOR_GRAD2, "Contact your supervisor or the SAAS and organize a crate delivery.");
- }
- PlayerInfo[playerid][pDuty] = 1;
- SetPlayerToTeamColor(playerid);
- SendClientMessageEx(playerid, COLOR_GRAD2, "You may now select your weapons from the equipment locker");
- }
- else if(PlayerInfo[playerid][pDuty]==1)
- {
- format(string, sizeof(string), "* %s %s places their badge and gun in their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- if(IsAMedic(playerid))
- {
- Medics -= 1;
- }
- SetPlayerHealth(playerid, 100.0);
- RemoveArmor(playerid);
- PlayerInfo[playerid][pDuty] = 0;
- SetPlayerToTeamColor(playerid);
- }
- }
- case 1:
- {
- new
- szDialog[(32 + 8) * (MAX_GROUP_WEAPONS+1)];
- for(new i = 0; i != MAX_GROUP_WEAPONS; ++i) {
- if(arrGroupData[iGroupID][g_iLockerGuns][i]) {
- format(szDialog, sizeof szDialog, "%s\n(%i) %s", szDialog, arrGroupData[iGroupID][g_iLockerGuns][i], Weapon_ReturnName(arrGroupData[iGroupID][g_iLockerGuns][i]));
- if (arrGroupData[iGroupID][g_iLockerCostType] == 2) format(szDialog, sizeof szDialog, "%s $%d", szDialog, arrGroupData[iGroupID][g_iLockerCost][i]);
- }
- else strcat(szDialog, "\n(empty)");
- }
- strcat(szDialog, "\nAccessories");
- format(string, sizeof(string), "%s Weapon Locker", arrGroupData[iGroupID][g_szGroupName]);
- ShowPlayerDialog(playerid, G_LOCKER_EQUIPMENT, DIALOG_STYLE_LIST, string, szDialog, "Purchase", "Cancel");
- }
- case 2:
- {
- ShowPlayerDialog(playerid, G_LOCKER_UNIFORM, DIALOG_STYLE_INPUT, "Uniform","Choose a skin (by ID).", "Select", "Cancel");
- }
- case 3:
- {
- ShowPlayerDialog(playerid, G_LOCKER_CLEARSUSPECT,DIALOG_STYLE_INPUT, arrGroupData[iGroupID][g_szGroupName]," Who would you like to clear?","Clear","Return");
- }
- case 4: // LEOs - HP + Armour
- {
- if(arrGroupData[iGroupID][g_iLockerStock] > 1 && arrGroupData[iGroupID][g_iLockerCostType] == 0)
- {
- SetPlayerArmor(playerid, 100);
- SetPlayerHealth(playerid, 100.0);
- arrGroupData[iGroupID][g_iLockerStock] -= 1;
- new str[128], file[32];
- format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of 1 HG Material.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
- new month, day, year;
- getdate(year,month,day);
- format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
- Log(file, str);
- }
- else if(arrGroupData[iGroupID][g_iLockerCostType] == 1)
- {
- if(arrGroupData[iGroupID][g_iBudget] > 2500)
- {
- SetPlayerArmor(playerid, 100);
- SetPlayerHealth(playerid, 100.0);
- arrGroupData[iGroupID][g_iBudget] -= 2500;
- new str[128], file[32];
- format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of $2,500.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
- new month, day, year;
- getdate(year,month,day);
- format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
- Log(file, str);
- }
- else return SendClientMessageEx(playerid, COLOR_GRAD2, " Your agency cannot afford the vest. ($2,500)");
- }
- else if(arrGroupData[iGroupID][g_iLockerCostType] == 2)
- {
- if(GetPlayerCash(playerid) > 2500)
- {
- SetPlayerArmor(playerid, 100);
- SetPlayerHealth(playerid, 100.0);
- GivePlayerCash(playerid, -2500);
- new str[128], file[32];
- format(str, sizeof(str), "%s took a vest out of the %s locker at a personal cost of $2,500.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
- new month, day, year;
- getdate(year,month,day);
- format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
- Log(file, str);
- }
- else return SendClientMessageEx(playerid, COLOR_GRAD2, " You cannot afford the vest. ($2,500)");
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_RED, "The locker doesn't have the stock for your armor vest.");
- SendClientMessageEx(playerid, COLOR_GRAD2, "Contact your supervisor or the SAAS and organize a crate delivery.");
- }
- }
Add Comment
Please, Sign In to add comment