public WriteTicket(playerid, type, price, target, reason, warn)
{
new dialog[800];
new dialog2[381];
new dialog3[381];
new string[100];
new factxt[40];
new warntxt[12];
new year, month, day;
new offender = ReturnUser("target");
if(offender == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, "The offender logged off while you were writing the ticket.");
return 1;
}
format(string, sizeof(string), "* %s writes a ticket, scratches it out and gives it to %s.", GetPlayerNameEx(playerid), target);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(PlayerInfo[playerid][pMember] == 1)
{
factxt = "{0E29C7}Los Santos Police Department";
}
else if(PlayerInfo[playerid][pMember] == 2)
{
factxt = "{3A7AAB}Federal Bureau of Investigation";
}
else if(PlayerInfo[playerid][pMember] == 7)
{
factxt = "{8C6B1C}San Andreas Sherrif Department";
}
else if(PlayerInfo[playerid][pMember] == 11)
{
factxt = "{2DA873}San Andreas Defense Force";
}
else
{
factxt = "Government of San Andreas";
}
if(warn == 1)
{
warntxt = "{FF0000}Yes";
}
else
{
warntxt = "No";
}
getdate(year, month, day);
if(type == 1)
{
format(dialog,sizeof(dialog), "{DEF7E4}TICKET - TRAFFIC VIOLATION - %s {DEF7E4}\n\n\n\nYou have been citated for violation a trafficlaw.", factxt);
strcat(dialog, "The exact reason can be found below.\nYou are by law required to sign this ticket, if you fail to do this you will be arrested.\n");
format(dialog2,sizeof(dialog2), "\n\n\n- Date: %d - %d - %d [DD-MM-YYYY]\n- Issued to: %s\n- Type of ticket: Traffic Violation\n", day, month, year, target);
format(dialog3,sizeof(dialog3), "- Describtion of offence: $s\n- Driver License Infraction: %s\n- Amount of money to be paid: $%d", reason, warntxt, price);
strcat(dialog, dialog2);
strcat(dialog, dialog3);
strcat(dialog, "\n\nPut your signature below, failure to sign this document will result in arrest.\nThe money can be paid afterwards at the Police Department.");
ShowPlayerDialog(playerid, TICKETSUSPECT, DIALOG_STYLE_MSGBOX, "Ticket", string, "Sign", "Do not sign");
return 1;
}
else if(type == 2)
{
return 1;
}
else if(type == 3)
{
return 1;
}
return 1;
}
if(dialogid == TICKET1)
{
if(response)
{
new string[230];
strcat(string, "{DEF7E4}TICKET - Name of offender\n\n\n\nInsert the name of the citizen you are going to citate. Don't forget to check the MDC.\n\n");
strcat(string, "(( Insert the FULL name of the player, including the underscore (_), not an ID or half name! ))");
ShowPlayerDialog(playerid, TICKET2, DIALOG_STYLE_INPUT, "TICKET", string, "Next", "Cancel");
return 1;
}
}
if(dialogid == TICKET2)
{
if(response)
{
new target = ReturnUser("inputtext");
if(target != INVALID_PLAYER_ID)
{
new string[230];
strcat(string, "{DEF7E4}Traffic Violation\nOffence\nAdministration Fee");
ShowPlayerDialog(playerid, TICKET3, DIALOG_STYLE_LIST, "TICKET - Type of ticket", string, "Next", "Cancel");
format(PlayerInfo[playerid][pTicketTarget], 26, "%s", target);
return 1;
}
else
{
new string[310];
strcat(string, "{FF0000}That citizen is not registered in our files! Please fill out a correct name!");
strcat(string, "{DEF7E4}TICKET - Name of offender\n\n\n\nInsert the name of the citizen you are going to citate. Don't forget to check the MDC.\n\n");
strcat(string, "(( Insert the FULL name of the player, including the underscore (_), not an ID or half name! ))");
ShowPlayerDialog(playerid, TICKET2, DIALOG_STYLE_INPUT, "Ticket", string, "Next", "Cancel");
return 1;
}
}
}
if(dialogid == TICKET3)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pTicketType] = 1; //Traffic Violation
new string[230];
strcat(string, "{DEF7E4}Add infraction point\nDo not add infraction");
ShowPlayerDialog(playerid, TICKET4, DIALOG_STYLE_LIST, "TICKET - Infraction added to ticket?", string, "Next", "Cancel");
return 1;
}
else if(listitem == 1)
{
PlayerInfo[playerid][pTicketType] = 2; //Offence
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
else if(listitem == 2)
{
PlayerInfo[playerid][pTicketType] = 3; //Administration Fee
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
}
}
if(dialogid == TICKET4)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pTicketWarn] = 1;
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
else if(listitem == 1)
{
PlayerInfo[playerid][pTicketWarn] = 0;
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
}
}
if(dialogid == TICKET5)
{
if(response)
{
if(strlen(inputtext) < 2 || strlen(inputtext) > 128)
{
strcat(string, "{DEF7E4}Howmuch money does the offender have to pay?\n\n\nOnly use digits, do not insert a dollarsign or commas.\n\n-Minimum: 1$\n-Maximum: 25,000$");
ShowPlayerDialog(playerid, TICKET6, DIALOG_STYLE_INPUT, "TICKET - Price", string, "Next", "Cancel");
format(PlayerInfo[playerid][pTicketReason], 128, "%s", inputtext);
return 1;
}
else
{
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
}
}
if(dialogid == TICKET6)
{
if(response)
{
if(IsNumeric(inputtext))
{
if(inputtext < 1) || (inputtext > 25000)
{
new price;
price = inputtext;
PlayerInfo[playerid][pTicketPrice] = price;
WriteTicket(playerid, PlayerInfo[playerid][pTicketType], PlayerInfo[playerid][pTicketPrice], PlayerInfo[playerid][pTicketTarget], PlayerInfo[playerid][pTicketReason], PlayerInfo[playerid][pTicketWarn]);
return 1;
}
else
{
strcat(string, "{FF0000}Tickets must be between 1 and 25,000 dollar!\n\n");
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
}
else
{
strcat(string, "{FF0000}Only insert numbers, please.\n\n");
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
return 1;
}
}
}
public WriteTicket(playerid, type, price, target, reason, warn)
{
new dialog[800];
new dialog2[381];
new dialog3[381];
new string[100];
new factxt[40];
new warntxt[12];
new year, month, day;
new offender = ReturnUser("target");
if(offender == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, "The offender logged off while you were writing the ticket.");
}
format(string, sizeof(string), "* %s writes a ticket, scratches it out and gives it to %s.", GetPlayerNameEx(playerid), target);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(PlayerInfo[playerid][pMember] == 1)
{
factxt = "{0E29C7}Los Santos Police Department";
}
else if(PlayerInfo[playerid][pMember] == 2)
{
factxt = "{3A7AAB}Federal Bureau of Investigation";
}
else if(PlayerInfo[playerid][pMember] == 7)
{
factxt = "{8C6B1C}San Andreas Sherrif Department";
}
else if(PlayerInfo[playerid][pMember] == 11)
{
factxt = "{2DA873}San Andreas Defense Force";
}
else
{
factxt = "Government of San Andreas";
}
if(warn == 1)
{
warntxt = "{FF0000}Yes";
}
else
{
warntxt = "No";
}
getdate(year, month, day);
if(type == 1)
{
format(dialog,sizeof(dialog), "{DEF7E4}TICKET - TRAFFIC VIOLATION - %s {DEF7E4}\n\n\n\nYou have been citated for violation a trafficlaw.", factxt);
strcat(dialog, "The exact reason can be found below.\nYou are by law required to sign this ticket, if you fail to do this you will be arrested.\n");
format(dialog2,sizeof(dialog2), "\n\n\n- Date: %d - %d - %d [DD-MM-YYYY]\n- Issued to: %s\n- Type of ticket: Traffic Violation\n", day, month, year, target);
format(dialog3,sizeof(dialog3), "- Describtion of offence: $s\n- Driver License Infraction: %s\n- Amount of money to be paid: $%d", reason, warntxt, price);
strcat(dialog, dialog2);
strcat(dialog, dialog3);
strcat(dialog, "\n\nPut your signature below, failure to sign this document will result in arrest.\nThe money can be paid afterwards at the Police Department.");
ShowPlayerDialog(playerid, TICKETSUSPECT, DIALOG_STYLE_MSGBOX, "Ticket", string, "Sign", "Do not sign");
}
else if(type == 2)
{
}
else if(type == 3)
{
}
return 1;
}
if(dialogid == TICKET1)
{
if(response)
{
new string[230];
strcat(string, "{DEF7E4}TICKET - Name of offender\n\n\n\nInsert the name of the citizen you are going to citate. Don't forget to check the MDC.\n\n");
strcat(string, "(( Insert the FULL name of the player, including the underscore (_), not an ID or half name! ))");
ShowPlayerDialog(playerid, TICKET2, DIALOG_STYLE_INPUT, "TICKET", string, "Next", "Cancel");
}
}
if(dialogid == TICKET2)
{
if(response)
{
new target = ReturnUser("inputtext");
if(target != INVALID_PLAYER_ID)
{
new string[230];
strcat(string, "{DEF7E4}Traffic Violation\nOffence\nAdministration Fee");
ShowPlayerDialog(playerid, TICKET3, DIALOG_STYLE_LIST, "TICKET - Type of ticket", string, "Next", "Cancel");
format(PlayerInfo[playerid][pTicketTarget], 26, "%s", target);
}
else
{
new string[310];
strcat(string, "{FF0000}That citizen is not registered in our files! Please fill out a correct name!");
strcat(string, "{DEF7E4}TICKET - Name of offender\n\n\n\nInsert the name of the citizen you are going to citate. Don't forget to check the MDC.\n\n");
strcat(string, "(( Insert the FULL name of the player, including the underscore (_), not an ID or half name! ))");
ShowPlayerDialog(playerid, TICKET2, DIALOG_STYLE_INPUT, "Ticket", string, "Next", "Cancel");
}
}
}
if(dialogid == TICKET3)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pTicketType] = 1; //Traffic Violation
new string[230];
strcat(string, "{DEF7E4}Add infraction point\nDo not add infraction");
ShowPlayerDialog(playerid, TICKET4, DIALOG_STYLE_LIST, "TICKET - Infraction added to ticket?", string, "Next", "Cancel");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pTicketType] = 2; //Offence
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
else if(listitem == 2)
{
PlayerInfo[playerid][pTicketType] = 3; //Administration Fee
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
}
}
if(dialogid == TICKET4)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pTicketWarn] = 1;
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pTicketWarn] = 0;
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
}
}
if(dialogid == TICKET5)
{
if(response)
{
if(strlen(inputtext) < 2 || strlen(inputtext) > 128)
{
strcat(string, "{DEF7E4}Howmuch money does the offender have to pay?\n\n\nOnly use digits, do not insert a dollarsign or commas.\n\n-Minimum: 1$\n-Maximum: 25,000$");
ShowPlayerDialog(playerid, TICKET6, DIALOG_STYLE_INPUT, "TICKET - Price", string, "Next", "Cancel");
format(PlayerInfo[playerid][pTicketReason], 128, "%s", inputtext);
}
else
{
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
}
}
if(dialogid == TICKET6)
{
if(response)
{
if(IsNumeric(inputtext))
{
if(inputtext < 1) || (inputtext > 25000)
{
new price;
price = inputtext;
PlayerInfo[playerid][pTicketPrice] = price;
WriteTicket(playerid, PlayerInfo[playerid][pTicketType], PlayerInfo[playerid][pTicketPrice], PlayerInfo[playerid][pTicketTarget], PlayerInfo[playerid][pTicketReason], PlayerInfo[playerid][pTicketWarn]);
}
else
{
strcat(string, "{FF0000}Tickets must be between 1 and 25,000 dollar!\n\n");
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
}
else
{
strcat(string, "{FF0000}Only insert numbers, please.\n\n");
strcat(string, "{DEF7E4}What law did the offender break?\n\n\nPlease insert a reason with a maximum of 128 letters.");
ShowPlayerDialog(playerid, TICKET5, DIALOG_STYLE_INPUT, "TICKET - Reason", string, "Next", "Cancel");
}
}
}
|
and if this is the code of Python Roleplay, I wouldn't bet it is "Heaven of roleplay"
|
|
Why did you add so much code before recompiling? If it crashes remove the new stuff and add it back in slowly (line by line or section by section) until it crashes, then you know where the problem is.
|
new price;
price = strval(price);
PlayerInfo[playerid][pTicketPrice] = price;
WriteTicket(playerid, PlayerInfo[playerid][pTicketType], PlayerInfo[playerid][pTicketPrice], PlayerInfo[playerid][pTicketTarget], PlayerInfo[playerid][pTicketReason], PlayerInfo[playerid][pTicketWarn]);