PDA

View Full Version : Need Help


Josip_Hrnjak
19/05/2012, 08:39 PM
Can u help me to do this in Dialog?
format(coordsstring, sizeof(coordsstring),"|_________________________________________________ | %s (%d) |_________________________________________________ |",name, targetid);
SendClientMessage(playerid, COLOR_GREEN,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Level: %d | Sex: %s | Age: %d | Cash: $%d | Bank: $%d | Ph: %d | Regular Rank: %s |", level,atext,age,cash,account,pnumber,drank);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Total Playing Hours: %d | Total Playing Mins: %d | Total Playing Secs: %d | BiggestFish: %d | TimesArrested: %d |",(ptime / 3600), (ptime / 60), ptime,bigfish,arrests);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Respect: %d/%d | Deaths: %d | Drugs: %d | Materials: %d | Team: %s | Rank: %s | Kills: %d | Warnings: %d |",exp,expamount,Deaths,drugs,mats,ttext,rtext, Kills,warned);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Swat Rank: %s | Tactical Rank: %s | Forces Rank: %s | DD Manager: %d | LottoNr: %d | Crimes: %d |",swatr,tacticalr,specialfr,drights,lotto,crimes);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Fighting: %s | Tester Rank: %d | ColtSkill: %d | Silenced Skill: %d | Deagle Skill: %d | Shotgun Skill: %d |",fight, tester, Colt,Silenced,Deagle, Shotgun);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| SawnSkill: %d | Combat Skill: %d | Uzi Skill: %d | SMG Skill: %d | M4 Skill: %d | AK-47 Skill: %d |", Sawn,Combat,Uzi, Smg, M4, Ak47);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| Health: %.1f | Armour: %.1f | IP: %s | Fishes: %d | Last Leaving: %s | Duty Banned: %d |", health, armour, Playersip, fishes, PlayerInfo[targetid][pWhyLeft], dban);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "| House key: %d | Business key: %d | HireKey: %d | Interior: %d | Virtual World: %d | Local: %d | Job: %s |", housekey,bizkey,HireCar[targetid],intir,virworld,local,jtext);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
if (PlayerInfo[targetid][pPcarkey] != 9999)
{
new vehiclename[24];
GetVehicleName(carkey, vehiclename, sizeof(vehiclename));
format(coordsstring, sizeof(coordsstring), "| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |",carkey,vehiclename, CarInfo[carkey][cModel], GetVehiclePrice(carkey), CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock], CarInfo[carkey][cCode]);
SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
}
if (PlayerInfo[targetid][pPcarkey2] != 9999)
{
new vehiclename[24];
GetVehicleName(carkey2, vehiclename, sizeof(vehiclename));
format(coordsstring, sizeof(coordsstring), "| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |",carkey2,vehiclename, CarInfo[carkey2][cModel], GetVehiclePrice(carkey2), CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock], CarInfo[carkey2][cCode]);
SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
}
}
}

[FMJ]PowerSurge
19/05/2012, 09:16 PM
Make coordsstring bigger if needed and put all the format() lines into one long string using strcat, separated with \n.

For example...

new coordsstring[512];
new coordsstring2[176];
format(coordsstring2, sizeof(coordsstring2), "| Level: %d | Sex: %s | Age: %d | Cash: $%d | Bank: $%d | Ph: %d | Regular Rank: %s |\n", level,atext,age,cash,account,pnumber,drank);
strcat(coordsstring2, coordsstring);
format(coordsstring2, sizeof(coordsstring2), "| Total Playing Hours: %d | Total Playing Mins: %d | Total Playing Secs: %d | BiggestFish: %d | TimesArrested: %d |\n",(ptime / 3600), (ptime / 60), ptime,bigfish,arrests);
strcat(coordsstring2, coordsstring);

...etc for all lines, then use it in a ShowPlayerDialog.

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Stats", coordsstring, "Close", "");

Josip_Hrnjak
20/05/2012, 08:47 AM
ok.. but if i want dialog look like this etc:
Level:
Sex:
Age:

than i must do this, if i undersood:
format(coordsstring2, sizeof(coordsstring2), "| Level: %d |\n", level);
strcat(coordsstring2, coordsstring);
format(coordsstring2, sizeof(coordsstring2), "| Sex: %d |\n", atext);
strcat(coordsstring2, coordsstring);
...
and this goes at the and of the dialog..??
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Stats", coordsstring, "Close", "")

And all of that i must put at : ShowPlayerDialog or?
And one more question, how can i put that in dialog above OOC stats writes OOC STATS, and above IC stats writes IC STATS ??

[FMJ]PowerSurge
20/05/2012, 12:02 PM
Yes. \n means new line, so you just put the \n wherever you want a new line.

strcat is adding all the coordsstring2s that you formatted to one long string, coordsstring, so all you gotta do is, like I said, show coordsstring after "Stats".

If you want to put two different sections into one dialog, you just have to do the same thing, but with 'OOC stats' and 'IC stats' rather than the actual stats.

For example,

format(coordsstring2, sizeof(coordsstring2), "\t\t| OOC stats |\n\n");
// "\t\t" more-or-less centers your text. You can have it to the left, center or right by using more/less "\t"s.
strcat(coordsstring2, coordsstring);
format(coordsstring2, sizeof(coordsstring2), "| Level: %d |\n", level);
strcat(coordsstring2, coordsstring);
format(coordsstring2, sizeof(coordsstring2), "\t\t| IC stats |\n\n");
strcat(coordsstring2, coordsstring);
format(coordsstring2, sizeof(coordsstring2), "| Sex: %s |\n", atext);
strcat(coordsstring2, coordsstring);

Etc etc.

Josip_Hrnjak
20/05/2012, 01:19 PM
Thanks alot!! :D