Confusing bug (listitem and function), help appreciated.
#1

pawn Код:
stock GetCrime(type)
{
    new string[64];
    printf("Type %d", type);
   
    switch(type)
    {
        case 0: string = "Arson";
        case 1: string = "Arson (Attempted)";
        case 2: string = "Assault";
        case 3: string = "Battery";
        case 4: string = "Bribery";
        case 5: string = "Burglary";
        case 6: string = "Burglary (Attempted)";
        case 7: string = "Conspiracy";
        case 8: string = "Disorderly Conduct";
        case 9: string = "Disturbing the Peace";
        case 10: string = "Domestic Violence";
        case 11: string = "Drug Cultivation or Manufacturing";
        case 12: string = "Drug Possesion";
        case 13: string = "Drug Trafficking or Distribution";
        case 14: string = "Drunk Driving";
        case 15: string = "Embezzlement";
        case 16: string = "Extortion";
        case 17: string = "Fraud";
        case 18: string = "Grand Theft Auto";
        case 19: string = "Grand Theft Auto (Attempted)";
        case 20: string = "Harassment";
        case 21: string = "Hate Crime";
        case 22: string = "Kidnapping";
        case 23: string = "Kidnapping (Attempted)";
        case 24: string = "Money Laundering";
        case 25: string = "Murder";
        case 26: string = "Murder (Attempted)";
        case 27: string = "Murder (Public Official/Police Officer)";
        case 28: string = "Prostitution";
        case 29: string = "Public Intoxication";
        case 30: string = "Rape";
        case 31: string = "Rape (Attempted)";
        case 32: string = "Robbery";
        case 33: string = "Robbery (Attempted)";
        case 34: string = "Sexual Assault";
        case 35: string = "Stalking";
        case 36: string = "Tax Evasion";
        case 37: string = "Theft";
        case 38: string = "Theft (Attempted)";
        case 39: string = "Vandalism";
    }
    printf("string %s", string);
    return string;
}
pawn Код:
format(string1, sizeof(string1),"Arson\nArson (Attempted)\nAssault\nBattery\nBribery\nBurglary\nBurglary (Attempted)\nDisturbing the Peace\nDomestic Violence\nDrug Cultivation or Manufacturing\nDrug Possesion\nDrug Trafficking or Distribution\n");
strcat(string, string1);
format(string2, sizeof(string2),"Drunk Driving\nEmbezzlement\nExtortion\nFraud\nGrand Theft Auto\nGrand Theft Auto (Attempted)\nHarassment\nHate Crime\nKidnapping\nKidnapping (Attempted)\nMoney Laundering\n");
strcat(string, string2);
format(string3, sizeof(string3),"Murder\nMurder (Attempted)\nMurder (Public Official/Police Officer)\nProstitution\nPublic Intoxication\nRape\nRape (Attempted)\nRobbery\nRobbery (Attempted)\nStalking\nTax Evasion\nTheft\nTheft (Attempted)\nVandalism");
strcat(string, string3);
ShowPlayerDialog(playerid, DIALOG_ADDRCD, DIALOG_STYLE_LIST, "Please select a crime to add to records", string, "Search", "Cancel");
So I use this function as a crime list. This exact same list is used in a DIALOG_STYLE_LIST and I use the listitem as a reference to get its name. The problem is, none of them match up despite them being exactly the same.

i.e GetCrime(type) 25 = Murder...
the result when the listitem is used as the type is: Kidnapping (Attempted)....which is extremely confusing.

Could anyone shed some light?
Reply
#2

You're missing Conspiracy, Disorderly Conduct and Sexual Assault from the dialog.
Reply
#3

Dude, you are an absolute hero, I looked like a billion times...!
Reply
#4

Those kind of kinks are the worst.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)