[Request] Can make dialog in stats?
#1

So im using larp gm and i want to add dialog when i type /stats to give it on dialog
because without dialog is verry stupid can anyone help me?
Reply
#2

For example:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/stats", true))
{
new string[128];
format(string, sizeof(string), "Kills: %d\nDeaths: %d", stat1, stat2);
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Stats", string, "Close", "Close");
return 1;
}
return 0;
}
Try something like this.
Reply
#3

Depends what stats you need?

I guess a dialog can read all of your codes and let you read them.
I'm not that experienced with dialogs though.
Reply
#4

Quote:
Originally Posted by Pawno_Master
Посмотреть сообщение
Depends what stats you need?

I guess a dialog can read all of your codes and let you read them.
I'm not that experienced with dialogs though.
look

Код:
//-------------------------------[Stats]--------------------------------------------------------------------------
	if (strcmp(cmd, "/stats", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (gPlayerLogged[playerid] != 0)
			{
				ShowStats(playerid,playerid);
				new y, m, d;
				new h,mi,s;
				getdate(y,m,d);
				gettime(h,mi,s);
				format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /stats",d,m,y,h,mi,s,sendername);
				CommandLog(string);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not Logged in!");
				return 1;
			}
		}
		return 1;
	}
I have Raven RP but i want to add /stats to be in dialog
Reply
#5

larp.pwn

http://www.mediafire.com/?yb598e6ex84j86i


This is from Raven Roleplay you can check..

and here have something from stats

Код:
		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] != 999)
		{
Reply
#6

at top of script:
Код:
#define STATS 1000
Код:
if (strcmp(cmd, "/stats", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (gPlayerLogged[playerid] != 0)
			{
                                             new string[128];
                                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /stats",d,m,y,h,mi,s,sendername);
                                            ShowPlayerDialog(playerid, STATS, DIALOG_STYLE_LIST, "STATS", "string", "Okay", "Exit");
}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not Logged in!");
				return 1;
			}
		}
		return 1;
	}
OnDialogResponse:
Код:
if(dialogid == STATS)
	{
		if(response)
		{
 }
else
{
return 1;
}
}
untested but it should work, you will need to fix the indentation in it
Reply
#7

Line:10257:
Код:
if(dialogid == STATS)
Line:10262:
Код:
else
Line:10267
Код:
		if(dialogid == 300)
Line:35940
Код:
if (strcmp(cmd, "/stats", true) == 0)
Line:35946
Код:
			    new string[128];
Line:35947
Код:
			    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /stats",d,m,y,h,mi,s,sendername);
Line:35958
Код:
	if (strcmp(cmd, "/calendar", true) == 0)
Код:
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(10257) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(10262) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(10267) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(35940) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(35946) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(35947) : error 017: undefined symbol "d"
C:\Documents and Settings\GBL\Desktop\RP\gamemodes\larp.pwn(35958) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#8

change string[128]; to str[128]; and i dont know about error 017 the rest is just because you havent fixed the indentation
Reply
#9

I change it but still Error!

Код:
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(10257) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(10262) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(10267) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(35940) : warning 217: loose indentation
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(35947) : error 017: undefined symbol "d"
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(35946) : warning 204: symbol is assigned a value that is never used: "str"
C:\Documents and Settings\GBL\Desktop\Nov FIx\gamemodes\larp.pwn(35958) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And how to fix the indentation ??
Reply
#10

https://sampwiki.blast.hk/wiki/Errors_Li...tion_.28217.29
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)