SA-MP Forums Archive
HELP[REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HELP[REP] (/showthread.php?tid=313210)



HELP[REP] - Dan_Barocu - 24.01.2012

stats!

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

		    }
it works but if i type /stats only this will appear in /stats box:
Код:
| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |



Re: HELP[REP] - Abreezy - 24.01.2012

I believe you need to make different string names for the lines, because right now your using the same, so it's going to take the last string and only show that one, If i'm correct that is.


Re: HELP[REP] - Dan_Barocu - 24.01.2012

i dont understand im romanian..sorry..please show me an example..


Re: HELP[REP] - Abreezy - 24.01.2012

You can't put the same string into 1 dialog, you need multiple strings.


Re: HELP[REP] - Dan_Barocu - 24.01.2012

?i dont get it...


Re: HELP[REP] - Gh05t_ - 24.01.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
?i dont get it...
When formatting, you must remember that the variable is assigned to THAT string. Formatting the string multiple times simply causes it to be overwritten and outputs the last given possible assignment.

pawn Код:
main()
{
    new integer; //Code 1
    integer = 0;
    printf("%d", integer);
    integer = 1;
    printf("%d", integer);
   
    new string[] = "Hello"; //Code 2
    printf("%s",string);
    string = "World";
    printf("%s",string);
}
If you attempted to execute the code, you would have noticed that in 'Code 2', "Hello" is outputted to console, this is because "Hello" has been assigned to string and we have only prompted to execute THAT assignment. If you then noticed, string may be re-assigned and then outputs "World".


Re: HELP[REP] - Dan_Barocu - 24.01.2012

then can someone help me with my cmd problem please.


Re: HELP[REP] - Gh05t_ - 24.01.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
then can someone help me with my cmd problem please.
You may:

Assign a variable for each line of text you would like to output to the dialog.
pawn Код:
new str1[256], str2[256];
format(str1, sizeof(str1),"|%s (%d)|\n",name, targetid);
format(str2, sizeof(str2),"| Level: %d | Sex: %s | Age: %d | Cash: $%d | Bank: $%d | Ph: %d | Regular Rank: %s |\n", level,atext,age,cash,account,pnumber,drank);
etc...
One independent formatted assessment.
pawn Код:
new string[500]
format(str1, sizeof(str1),"|%s (%d)|\n | Level: %d | Sex: %s | Age: %d | Cash: $%d | Bank: $%d | Ph: %d | Regular Rank: %s |\n", name, targetid, level,atext,age,cash,account,pnumber,drank);



Re: HELP[REP] - Dan_Barocu - 24.01.2012

then look at whole code what do i do with vehicle 1and 2

see if (PlayerInfo[targetid][pPcarkey] != 9999)
{
new vehiclename[24];
GetVehicleName(carkey, vehiclename, sizeof(vehiclename));
format( statdialogstring, sizeof( statdialogstring ),"| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |\n",carkey,vehiclename, CarInfo[carkey][cModel], GetVehiclePrice(carkey), CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock], CarInfo[carkey][cCode]);
}
if (PlayerInfo[targetid][pPcarkey2] != 9999)
{
new vehiclename[24];
GetVehicleName(carkey2, vehiclename, sizeof(vehiclename));
format( statdialogstring, sizeof( statdialogstring ),"| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |\n",carkey2,vehiclename, CarInfo[carkey2][cModel], GetVehiclePrice(carkey2), CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock], CarInfo[carkey2][cCode]);
}
ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"S tats",statdialogstring,"Inchide","");
}

}


Re: HELP[REP] - Gh05t_ - 24.01.2012

pawn Код:
if (PlayerInfo[targetid][pPcarkey] != 9999)
{
    new string[256];
    new vehiclename[24];
    GetVehicleName(carkey, vehiclename, sizeof(vehiclename));
    format(string, sizeof(string),"| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |\n", carkey, vehiclename, CarInfo[carkey][cModel], GetVehiclePrice(carkey), CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock], CarInfo[carkey][cCode]);
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Stats",string,"Inchide","");
}
if (PlayerInfo[targetid][pPcarkey2] != 9999)
{
    new string[256];
    new vehiclename[24];
    GetVehicleName(carkey2, vehiclename, sizeof(vehiclename));
    format(string, sizeof(string),"| CarID: %d | Model: %s (%d) | VehValue: %d | VehColor1: %d | VehColor2: %d | VehLocked: %d | Code: %d |\n",carkey2,vehiclename, CarInfo[carkey2][cModel], GetVehiclePrice(carkey2), CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock], CarInfo[carkey2][cCode]);
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Stats",string,"Inchide","");
}