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=582047)



Help (rep+) - manishmulchandani11 - 17.07.2015

How to make a text (/stats cmd) in dialogs?

Here is my code:

Код:
SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");
		format(coordsstring, sizeof(coordsstring), "[Account]: Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(targetid),atext,level,exp,expamount,pnumber);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
	    format(coordsstring, sizeof(coordsstring), "[Details]: Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]",cash,account,costlevel,jtext,jlevel);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "[Details]: Married To:[%s] Affiliation:[%s] Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "[Upgrades]: Upgrade Points:[%d] Armor Upgrade:[%d] Health Upgrade:[%d] VIP:[%s]",points,shealth,shp,vip);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "[Property]: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,cartext1,cartext2,btext);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d]",mats,pot,crack,packages,crates,potseeds,products);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d] WTc:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Rod:[%s] Bait:[%s] Bait Left:[%d] Fishing Line[%s]", rod, bait, baita, line);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "[Records]: Playing Hours:[%d] Kills:[%d] Deaths:[%d] Biggest Fish:[%d] Crimes Commited:[%d] Times Arrested:[%d]",ptime,kills,deaths,bigfish,crimes,arrested);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Vehicle 1 ID: %d | Vehicle 1 TID: %d | Vehicle 2 ID: %d | Vehicle 2 TID: %d", PlayerInfo[targetid][pCar][0], CarInfo[PlayerInfo[targetid][pCar][0]][c_ID], PlayerInfo[targetid][pCar][1], CarInfo[PlayerInfo[targetid][pCar][1]][c_ID]);
			SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Int: %d | VW: %d | Warnings: %d | JailTime: %d | Tikis: %d | Skin: %d",intir,vw,warns,jtime,tikis,skin);
			SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________");



Re: Help (rep+) - PrinceKumar - 17.07.2015

Can you elaborate your question ?
If i got it then you have to use ShowPlayerDialog instead of sendclientmessage. Otherwise elaborate it.


Re: Help (rep+) - manishmulchandani11 - 17.07.2015

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Can you elaborate your question ?
If i got it then you have to use ShowPlayerDialog instead of sendclientmessage. Otherwise elaborate it.
How to use ShowPlayerDialog into them? can you convert those sendclientmessage into them and paste here the codes?


Re: Help (rep+) - Moudix - 17.07.2015

Fornat a string and use /n to make a new line, then when the player types /stats,
PHP код:
ShowPlayerDialog(playeriddialogidhere,DIALOG_STYLE_LIST"Stats"string"Ok"""); 



Re: Help (rep+) - SpikeSpigel - 17.07.2015

Add that in the upper of your /stats command:

Код:
new szStr1[121],
We define szStr1

Then

Код:
szShowString[698];
and szShowString.

and that's the command.

Код:
		format(coordsstring, sizeof(coordsstring), "___________________________________________________________________");
		format(coordsstring, sizeof(coordsstring), "[Account]: Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(targetid),atext,level,exp,expamount,pnumber);
	    format(coordsstring, sizeof(coordsstring), "[Details]: Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]",cash,account,costlevel,jtext,jlevel);
		format(coordsstring, sizeof(coordsstring), "[Details]: Married To:[%s] Affiliation:[%s] Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
		format(coordsstring, sizeof(coordsstring), "[Upgrades]: Upgrade Points:[%d] Armor Upgrade:[%d] Health Upgrade:[%d] VIP:[%s]",points,shealth,shp,vip);
		format(coordsstring, sizeof(coordsstring), "[Property]: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,cartext1,cartext2,btext);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d]",mats,pot,crack,packages,crates,potseeds,products);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d] WTc:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Rod:[%s] Bait:[%s] Bait Left:[%d] Fishing Line[%s]", rod, bait, baita, line);
   		format(coordsstring, sizeof(coordsstring), "[Records]: Playing Hours:[%d] Kills:[%d] Deaths:[%d] Biggest Fish:[%d] Crimes Commited:[%d] Times Arrested:[%d]",ptime,kills,deaths,bigfish,crimes,arrested);
		ShowPlayerDialog(playerid, 8373, DIALOG_STYLE_MSGBOX, "Your Statistics", szShowString, "Ok","");
		return 1;
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Vehicle 1 ID: %d | Vehicle 1 TID: %d | Vehicle 2 ID: %d | Vehicle 2 TID: %d", PlayerInfo[targetid][pCar][0], CarInfo[PlayerInfo[targetid][pCar][0]][c_ID], PlayerInfo[targetid][pCar][1], CarInfo[PlayerInfo[targetid][pCar][1]][c_ID]);
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Int: %d | VW: %d | Warnings: %d | JailTime: %d | Tikis: %d | Skin: %d",intir,vw,warns,jtime,tikis,skin);
			ShowPlayerDialog(playerid, 8374, DIALOG_STYLE_MSGBOX, "Administrator Principal", szShowString, "Ok","");
			return 1;
		}
Don't forget 'bout +REP if I helped you


Re: Help (rep+) - PrinceKumar - 17.07.2015

Код:
SendClientMessage(playerid, COLOR_WHITE,coordsstring)	
ShowPlayerDialog(playerid,1000/*DialogId*/,DIALOG_STYLE_LIST,
	"STATS",
		coordsstring,
	"CLOSE", "");
just like that


Re: Help (rep+) - manishmulchandani11 - 17.07.2015

Quote:
Originally Posted by SpikeSpigel
Посмотреть сообщение
Add that in the upper of your /stats command:

Код:
new szStr1[121],
We define szStr1

Then

Код:
szShowString[698];
and szShowString.

and that's the command.

Код:
		format(coordsstring, sizeof(coordsstring), "___________________________________________________________________");
		format(coordsstring, sizeof(coordsstring), "[Account]: Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(targetid),atext,level,exp,expamount,pnumber);
	    format(coordsstring, sizeof(coordsstring), "[Details]: Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]",cash,account,costlevel,jtext,jlevel);
		format(coordsstring, sizeof(coordsstring), "[Details]: Married To:[%s] Affiliation:[%s] Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
		format(coordsstring, sizeof(coordsstring), "[Upgrades]: Upgrade Points:[%d] Armor Upgrade:[%d] Health Upgrade:[%d] VIP:[%s]",points,shealth,shp,vip);
		format(coordsstring, sizeof(coordsstring), "[Property]: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,cartext1,cartext2,btext);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d]",mats,pot,crack,packages,crates,potseeds,products);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d] WTc:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
   		format(coordsstring, sizeof(coordsstring), "[Inventory]: Rod:[%s] Bait:[%s] Bait Left:[%d] Fishing Line[%s]", rod, bait, baita, line);
   		format(coordsstring, sizeof(coordsstring), "[Records]: Playing Hours:[%d] Kills:[%d] Deaths:[%d] Biggest Fish:[%d] Crimes Commited:[%d] Times Arrested:[%d]",ptime,kills,deaths,bigfish,crimes,arrested);
		ShowPlayerDialog(playerid, 8373, DIALOG_STYLE_MSGBOX, "Your Statistics", szShowString, "Ok","");
		return 1;
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Vehicle 1 ID: %d | Vehicle 1 TID: %d | Vehicle 2 ID: %d | Vehicle 2 TID: %d", PlayerInfo[targetid][pCar][0], CarInfo[PlayerInfo[targetid][pCar][0]][c_ID], PlayerInfo[targetid][pCar][1], CarInfo[PlayerInfo[targetid][pCar][1]][c_ID]);
			format(coordsstring, sizeof(coordsstring), "[Admin Info] Int: %d | VW: %d | Warnings: %d | JailTime: %d | Tikis: %d | Skin: %d",intir,vw,warns,jtime,tikis,skin);
			ShowPlayerDialog(playerid, 8374, DIALOG_STYLE_MSGBOX, "Administrator Principal", szShowString, "Ok","");
			return 1;
		}
Don't forget 'bout +REP if I helped you
the dialog code that you gave me above isn't working, Now i can't see stats even in text (SendClientMessage) lol.


Re: Help (rep+) - manishmulchandani11 - 17.07.2015

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Код:
SendClientMessage(playerid, COLOR_WHITE,coordsstring)	
ShowPlayerDialog(playerid,1000/*DialogId*/,DIALOG_STYLE_LIST,
	"STATS",
		coordsstring,
	"CLOSE", "");
just like that
already tried something like that but a single problem occurs, it shows only last line in dialog.. -_-


Re: Help (rep+) - M4D - 17.07.2015

i didn't test it
just create a new variable (string) and use "strcat" to store formatted data into it
then show it as a dialog

set "string" size ... i think 2000 will be enough.
just try

PHP код:
new string[/*Size*/];
format(coordsstringsizeof(coordsstring), "[Account]: Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(targetid),atext,level,exp,expamount,pnumber);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Details]: Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]",cash,account,costlevel,jtext,jlevel);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Details]: Married To:[%s] Affiliation:[%s] Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Upgrades]: Upgrade Points:[%d] Armor Upgrade:[%d] Health Upgrade:[%d] VIP:[%s]",points,shealth,shp,vip);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Property]: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,cartext1,cartext2,btext);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Inventory]: Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d]",mats,pot,crack,packages,crates,potseeds,products);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Inventory]: Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d] WTc:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Inventory]: Rod:[%s] Bait:[%s] Bait Left:[%d] Fishing Line[%s]"rodbaitbaitaline);
strcat(stringcoordsstring);
format(coordsstringsizeof(coordsstring), "[Records]: Playing Hours:[%d] Kills:[%d] Deaths:[%d] Biggest Fish:[%d] Crimes Commited:[%d] Times Arrested:[%d]",ptime,kills,deaths,bigfish,crimes,arrested);
strcat(stringcoordsstring);
if(
PlayerInfo[playerid][pAdmin] >= 2)
{
    
format(coordsstringsizeof(coordsstring), "[Admin Info] Vehicle 1 ID: %d | Vehicle 1 TID: %d | Vehicle 2 ID: %d | Vehicle 2 TID: %d"PlayerInfo[targetid][pCar][0], CarInfo[PlayerInfo[targetid][pCar][0]][c_ID], PlayerInfo[targetid][pCar][1], CarInfo[PlayerInfo[targetid][pCar][1]][c_ID]);
    
strcat(stringcoordsstring);
    
format(coordsstringsizeof(coordsstring), "[Admin Info] Int: %d | VW: %d | Warnings: %d | JailTime: %d | Tikis: %d | Skin: %d",intir,vw,warns,jtime,tikis,skin);
    
strcat(stringcoordsstring);
}
//>Show it
ShowPlayerDialog(playerid/*Dialog ID*/DIALOG_STYLE_MSGBOX"Stats"string"Ok"""); 



Re: Help (rep+) - Roberto80 - 17.07.2015

Quote:
Originally Posted by Moudix
Посмотреть сообщение
Fornat a string and use /n to make a new line, then when the player types /stats,
PHP код:
ShowPlayerDialog(playeriddialogidhere,DIALOG_STYLE_LIST"Stats"string"Ok"""); 
You can't do this,string will be too long,and it will don't work