make this to dialog message box
#1

Hi. I would like to ask for a help who can make this to dialog box. Thank you very much!

Like this format below.

Player Stats(This is the title of the box)

Name: Thisisme (ID: 5)

Score: 42
Kills: 32
Deaths: 23
Money: 1000
Time logged in: 3 hours 4 minutes


and so on...

ALSO ADDITIONAL: When I target a player stats like /stats 32 (sample player ID) it will change the name the targeted player same with his current stats.

Код:
CMD:stats(playerid,params[])
{
     new id, h, m, d;
	 sscanf(params, "u", id);
	 if (isnull(params))
	 {
		new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
		format(Jstring, sizeof(Jstring), "_Statistics for '%s'_",GetName(playerid));
		SendClientMessage(playerid, green, Jstring);
		format(Jstring, sizeof(Jstring), "Score: %d | Money: $%d | Kills: %d | Deaths: %d | Ratio: %0.2f | Total spent Time: %s", GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][Kills], pInfo[playerid][Deaths], Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths], ConvertTime(seconds,m,h,d));
		return SendClientMessage(playerid, yellow, Jstring);
     }
	 else if(IsPlayerConnected(id))
	 {
        new seconds = gettime() - pInfo[id][ConnectedTime] + pInfo[id][TotalSecs];
		format(Jstring, sizeof(Jstring), "_Statistics for '%s'_",GetName(id));
		SendClientMessage(playerid, green, Jstring);
		format(Jstring, sizeof(Jstring), "Score: %d | Money: $%d | Kills: %d | Deaths: %d | Ratio: %0.2f | Total spent Time: %s", GetPlayerScore(id), GetPlayerMoney(id), pInfo[id][Kills], pInfo[id][Deaths], Float:pInfo[id][Kills]/Float:pInfo[id][Deaths], ConvertTime(seconds,m,h,d));
		return SendClientMessage(playerid, yellow, Jstring);
     }
	 else return ShowMessage(playerid, red, 2);
}
Reply
#2

Anyone please? Thnx looing forward.
Reply
#3

Doesn't Tested but Try This One,

pawn Код:
CMD:stats(playerid,params[])
{
     new id, h, m, d;
     sscanf(params, "u", id);
     if (isnull(params))
     {
        new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
        format(Jstring, sizeof(Jstring), "Score: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][Kills], pInfo[playerid][Deaths], Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats:",Jstring,"Ok","");
     }
     else if(IsPlayerConnected(id))
     {
        new seconds = gettime() - pInfo[id][ConnectedTime] + pInfo[id][TotalSecs];
        format(Jstring, sizeof(Jstring), "Score: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][Kills], pInfo[playerid][Deaths], Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats:",Jstring,"Ok","");
     }
     else return ShowMessage(playerid, red, 2);
}
Reply
#4

Hello, Did you test it ?
Reply
#5

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Hello, Did you test it ?
I just tested it, but the problem is that my name is not showing it should be like..

Player Stats:

Thisismyname (ID:4)

Score:
Kills:
Deaths:
Ratio:
Time logged in
so on..
Reply
#6

Here you go
pawn Код:
CMD:stats(playerid,params[])
{
    new id, h, m, d;
    new pName[24], pName2[24];
    GetPlayerName(playerid, pName, sizeof(pName)), GetPlayerName(id, pName2, sizeof(pName));
    sscanf(params, "u", id);
    if (isnull(params))
    {
        new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
        format(Jstring, sizeof(Jstring), "%s(%d)\n\nScore: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", pName, playerid, GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][Kills], pInfo[playerid][Deaths], Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",Jstring,"Ok","");
    }
    else if(IsPlayerConnected(id))
    {
        new seconds = gettime() - pInfo[id][ConnectedTime] + pInfo[id][TotalSecs];
        format(Jstring, sizeof(Jstring), "%s(%d)\n\nScore: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", pName2, id, GetPlayerScore(id), GetPlayerMoney(id), pInfo[id][Kills], pInfo[id][Deaths], Float:pInfo[id][Kills]/Float:pInfo[id][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",Jstring,"Ok","");
    }
    else return ShowMessage(playerid, red, 2);
}
Reply
#7

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Here you go
pawn Код:
CMD:stats(playerid,params[])
{
    new id, h, m, d;
    new pName[24], pName2[24];
    GetPlayerName(playerid, pName, sizeof(pName)), GetPlayerName(id, pName2, sizeof(pName));
    sscanf(params, "u", id);
    if (isnull(params))
    {
        new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
        format(Jstring, sizeof(Jstring), "%s(%d)\n\nScore: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", pName, playerid, GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][Kills], pInfo[playerid][Deaths], Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",Jstring,"Ok","");
    }
    else if(IsPlayerConnected(id))
    {
        new seconds = gettime() - pInfo[id][ConnectedTime] + pInfo[id][TotalSecs];
        format(Jstring, sizeof(Jstring), "%s(%d)\n\nScore: %d\nMoney: $%d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nTotal spent Time: %s", pName2, id, GetPlayerScore(id), GetPlayerMoney(id), pInfo[id][Kills], pInfo[id][Deaths], Float:pInfo[id][Kills]/Float:pInfo[id][Deaths], ConvertTime(seconds,m,h,d));
        return ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",Jstring,"Ok","");
    }
    else return ShowMessage(playerid, red, 2);
}
+rep wow nice!

And can you please help me with this script? Problem it says Server Unknown Command:

Код:
CMD:vkill(playerid, params[], help)
{
 	if(pInfo[playerid][pLevel] >= 1)
	{
		new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, yellow, "Usage: /vkill <Vehicle ID>");
        if(pInfo[playerid][pLevel] <= pInfo[id][pLevel]) return ShowMessage(playerid, red, 6);
        if(!IsPlayerConnected(id)) return ShowMessage(playerid, red, 2);
        CommandToAdmins(playerid,"vkill");
	    new vid;
	    vid = strval(params);
		if(GetVehicleModel(vid) == 0) return SendClientMessage(playerid, red, ">> Invalid Vehicle ID");
		DelVehicle(vid);
		format(Jstring,sizeof(Jstring),">> You have destroyed Vehicle ID: %d", vid);
		SendClientMessage(playerid,red,Jstring);
		return 1;
	}
	else return ShowMessage(playerid, red, 1);
}
Reply
#8

pawn Код:
CMD:vkill(playerid, params[], help)
{
    if(pInfo[playerid][pLevel] >= 1)
    {
        new veh;
        if(sscanf(params, "i", veh)) return SendClientMessage(playerid, yellow, "Usage: /vkill <Vehicle ID>");
        CommandToAdmins(playerid,"vkill");
        DelVehicle(veh);
        format(Jstring,sizeof(Jstring),">> You have destroyed Vehicle ID: %d", veh);
        SendClientMessage(playerid,red,Jstring);
    }
    else ShowMessage(playerid, red, 1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)