dialog with strings problems!
#1

@sup all, I gotta a problem since I started sicripting with strings in dialogs here is my code

pawn Код:
CMD:housestats(playerid,params[]){
    #pragma unused params
    new str[256],housenumber;
    housenumber = GetHouseID(playerid);
    format(str, sizeof(str), "Owner: %s\n", hInfo[housenumber][Name]);
    format(str, sizeof(str), "Cost: $%d\n", hInfo[housenumber][Cost]);
    format(str, sizeof(str), "Renter: %s\n", hInfo[housenumber][Renter]);
    format(str, sizeof(str), "Rentcost: $%d / hour\n", hInfo[housenumber][Rentcost]);
    strcat(str, "", sizeof(str));
    ShowPlayerDialog(playerid, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - House Stats", str, "OK","");
    return 1;}
I don't know how to create many strings in dialog and if I tried to it crashes. :/

I would be thankfully if you helped me guys!
Reply
#2

This should work -

pawn Код:
CMD:housestats(playerid,params[])
{
    new str[256],housenumber;
    housenumber = GetHouseID(playerid);
    format(str, sizeof(str), "Owner: %s\n", hInfo[housenumber][Name]);
    format(str, sizeof(str), "Cost: $%d\n", hInfo[housenumber][Cost]);
    format(str, sizeof(str), "Renter: %s\n", hInfo[housenumber][Renter]);
    format(str, sizeof(str), "Rentcost: $%d / hour\n", hInfo[housenumber][Rentcost]);
    ShowPlayerDialog(playerid, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - House Stats", str, "OK","");
    return 1;
}
Reply
#3

Код:
CMD:housestats(playerid,params[])
{
    #pragma unused params
    new str[256],str1[256]housenumber;
    housenumber = GetHouseID(playerid);
    format(str, sizeof(str), "Owner: %s\n", hInfo[housenumber][Name]);
    strcat(str1,str);
    format(str, sizeof(str), "Cost: $%d\n", hInfo[housenumber][Cost]);
    strcat(str1,str);
    format(str, sizeof(str), "Renter: %s\n", hInfo[housenumber][Renter]);
    strcat(str1,str);
    format(str, sizeof(str), "Rentcost: $%d / hour\n", hInfo[housenumber][Rentcost]);
    strcat(str1,str);
    ShowPlayerDialog(playerid, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - House Stats", str1, "Okay","");
    return 1;
}
Reply
#4

??

pawn Код:
CMD:housestats(playerid,params[])
{
    #pragma unused params
    new str[120], housenumber = GetHouseID(playerid);
    format(str, sizeof(str), "Owner: %s\nCost: $%d\nRenter: %s\nRentcost: $%d / hour", hInfo[housenumber][Name], hInfo[housenumber][Cost], hInfo[housenumber][Renter], hInfo[housenumber][Rentcost]);
    ShowPlayerDialog(playerid, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - House Stats", str, "Okay","");
    return 1;
}
Lol?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)