Stats dialog
#1

pawn Code:
CMD:stats(playerid,params[])
{
        new id;

        if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_RED," (Error): /stats [id]");
        if(!IsPlayerConnected(id)) return ErrorMessages(playerid,2);
        new gname[MAX_PLAYER_NAME];
        GetPlayerName(id,gname,sizeof(gname));
        new str[20][1900];
        format(str[0],1900,"| ------ | %s 's Status | ------- | \n", gname);
        strcat(str[1],str[0]);
        format(str[2],1900,""COL_WHITE"Score: "COL_LIGHTBLUE"%d \n "COL_WHITE"Money: "COL_LIGHTBLUE"$ %d \n"COL_WHITE"Kills: "COL_LIGHTBLUE"%d \n "COL_WHITE"Deaths: "COL_LIGHTBLUE"%d \n", pinfo[id][Score], pinfo[id][Money], pinfo[id][Kills], pinfo[id][Deaths]);
        strcat(str[1],str[2]);
        format(str[3],1900,""COL_WHITE"Admin Level: "COL_LIGHTBLUE"%d \n"COL_WHITE"VIP Level: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Robberies: "COL_LIGHTBLUE"%d \n ", pinfo[id][Admin], pinfo[id][VIP], pinfo[id][TotalRobs]);
        strcat(str[1],str[3]);
        format(str[4],1900,""COL_WHITE"Robbery Skill: "COL_LIGHTBLUE"%d \n, "COL_WHITE"Hitman Skill: "COL_LIGHTBLUE"%d \n,"COL_WHITE"Terrorist Skill: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Time Played: "COL_LIGHTBLUE" [%d : %d ] \n", pinfo[id][Robskill], pinfo[id][Hitmanskill], pinfo[id][Terskill],pinfo[id][Hours],pinfo[id][Minutes]);
        strcat(str[1],str[4]);
        format(str[5],1900,"| ---------------------------------------------------- |");
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,dialog_stats,DIALOG_STYLE_MSGBOX,"Statistics",str[1],"OK","");
        return 1;
}
when in press /stats 0 it says unkown cmd
Reply
#2

pawn Code:
CMD:stats(playerid,params[])
{
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
    if(!IsPlayerConnected(id))
    {
        new str[20][1900];
        format(str[0],1900,"| ------ | %s 's Status | ------- | \n", gname);
        strcat(str[1],str[0]);
        format(str[2],1900,""COL_WHITE"Score: "COL_LIGHTBLUE"%d \n "COL_WHITE"Money: "COL_LIGHTBLUE"$ %d \n"COL_WHITE"Kills: "COL_LIGHTBLUE"%d \n "COL_WHITE"Deaths: "COL_LIGHTBLUE"%d \n", pinfo[id][Score], pinfo[id][Money], pinfo[id][Kills], pinfo[id][Deaths]);
        strcat(str[1],str[2]);
        format(str[3],1900,""COL_WHITE"Admin Level: "COL_LIGHTBLUE"%d \n"COL_WHITE"VIP Level: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Robberies: "COL_LIGHTBLUE"%d \n ", pinfo[id][Admin], pinfo[id][VIP], pinfo[id][TotalRobs]);
        strcat(str[1],str[3]);
        format(str[4],1900,""COL_WHITE"Robbery Skill: "COL_LIGHTBLUE"%d \n, "COL_WHITE"Hitman Skill: "COL_LIGHTBLUE"%d \n,"COL_WHITE"Terrorist Skill: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Time Played: "COL_LIGHTBLUE" [%d : %d ] \n", pinfo[id][Robskill], pinfo[id][Hitmanskill], pinfo[id][Terskill],pinfo[id][Hours],pinfo[id][Minutes]);
        strcat(str[1],str[4]);
        format(str[5],1900,"| ---------------------------------------------------- |");
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,dialog_stats,DIALOG_STYLE_MSGBOX,"Statistics",str[1],"OK","");
        return 1;
    }
    else  return SCM(playerid, -1, "[ERROR]: Player ID/Name is not valid, Please try /stats [ID]");
}
Try it

EDITED
Reply
#3

lol so i will use strlen and sscanf...? this is wrong i guess?
Reply
#4

Edited
Reply
#5

Quote:
Originally Posted by ChandraLouis
View Post
Edited
How this could be wrong i don't have anything wrong on the sscanf..
Reply
#6

well, i just took that out from my Server GM
Reply
#7

Lol could someone help D:
Reply
#8

pawn Code:
CMD:stats(playerid,params[])
{
        new id;

        if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_RED," (Error): /stats [id]");
        if(!IsPlayerConnected(id)) return ErrorMessages(playerid,2);
        new gname[MAX_PLAYER_NAME];
        GetPlayerName(id,gname,sizeof(gname));
        new dialogstr[1900], string[300]; //increase/decrease the size if you need too.
        format(string,sizeof(string),"| ------ | %s 's Status | ------- | \n", gname);
        strcat(dialogstr,string);
        format(string,sizeof(string)""COL_WHITE"Score: "COL_LIGHTBLUE"%d \n "COL_WHITE"Money: "COL_LIGHTBLUE"$ %d \n"COL_WHITE"Kills: "COL_LIGHTBLUE"%d \n "COL_WHITE"Deaths: "COL_LIGHTBLUE"%d \n", pinfo[id][Score], pinfo[id][Money], pinfo[id][Kills], pinfo[id][Deaths]);
        strcat(dialogstr,string);
        format(string,sizeof(string),""COL_WHITE"Admin Level: "COL_LIGHTBLUE"%d \n"COL_WHITE"VIP Level: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Robberies: "COL_LIGHTBLUE"%d \n ", pinfo[id][Admin], pinfo[id][VIP], pinfo[id][TotalRobs]);
        strcat(dialogstr,string);
        format(string,sizeof(string),""COL_WHITE"Robbery Skill: "COL_LIGHTBLUE"%d \n, "COL_WHITE"Hitman Skill: "COL_LIGHTBLUE"%d \n,"COL_WHITE"Terrorist Skill: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Time Played: "COL_LIGHTBLUE" [%d : %d ] \n", pinfo[id][Robskill], pinfo[id][Hitmanskill], pinfo[id][Terskill],pinfo[id][Hours],pinfo[id][Minutes]);
        strcat(dialogstr,string);
        format(string,sizeof(string),"| ---------------------------------------------------- |");
        strcat(dialogstr,string);
        ShowPlayerDialog(playerid,dialog_stats,DIALOG_STYLE_MSGBOX,"Statistics",dialogstr,"OK","");
        return 1;
}
Reply
#9

pawn Code:
CMD:stats(playerid,params[])
{
        new id;

        if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_RED," (Error): /stats [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"(Error): Player ID is not valid.
        new gname[MAX_PLAYER_NAME];
        GetPlayerName(id,gname,sizeof(gname));
        new str[20][1900];
        format(str[0],1900,"
| ------ | %s 's Status | ------- | \n", gname);
        strcat(str[1],str[0]);
        format(str[2],1900,""COL_WHITE"Score: "COL_LIGHTBLUE"%d \n "COL_WHITE"Money: "COL_LIGHTBLUE"$ %d \n"COL_WHITE"Kills: "COL_LIGHTBLUE"%d \n "COL_WHITE"Deaths: "COL_LIGHTBLUE"%d \n", pinfo[id][Score], pinfo[id][Money], pinfo[id][Kills], pinfo[id][Deaths]);
        strcat(str[1],str[2]);
        format(str[3],1900,""COL_WHITE"Admin Level: "COL_LIGHTBLUE"%d \n"COL_WHITE"VIP Level: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Robberies: "COL_LIGHTBLUE"%d \n ", pinfo[id][Admin], pinfo[id][VIP], pinfo[id][TotalRobs]);
        strcat(str[1],str[3]);
        format(str[4],1900,""COL_WHITE"Robbery Skill: "COL_LIGHTBLUE"%d \n, "COL_WHITE"Hitman Skill: "COL_LIGHTBLUE"%d \n,"COL_WHITE"Terrorist Skill: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Time Played: "COL_LIGHTBLUE" [%d : %d ] \n", pinfo[id][Robskill], pinfo[id][Hitmanskill], pinfo[id][Terskill],pinfo[id][Hours],pinfo[id][Minutes]);
        strcat(str[1],str[4]);
        format(str[5],1900,"| ---------------------------------------------------- |");
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,dialog_stats,DIALOG_STYLE_MSGBOX,"Statistics",str[1],"OK","");
        return 1;
}
Try this :b
Reply
#10

Quote:
Originally Posted by biker122
View Post
pawn Code:
CMD:stats(playerid,params[])
{
        new id;

        if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_RED," (Error): /stats [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"(Error): Player ID is not valid.
        new gname[MAX_PLAYER_NAME];
        GetPlayerName(id,gname,sizeof(gname));
        new str[20][1900];
        format(str[0],1900,"
| ------ | %s 's Status | ------- | \n", gname);
        strcat(str[1],str[0]);
        format(str[2],1900,""COL_WHITE"Score: "COL_LIGHTBLUE"%d \n "COL_WHITE"Money: "COL_LIGHTBLUE"$ %d \n"COL_WHITE"Kills: "COL_LIGHTBLUE"%d \n "COL_WHITE"Deaths: "COL_LIGHTBLUE"%d \n", pinfo[id][Score], pinfo[id][Money], pinfo[id][Kills], pinfo[id][Deaths]);
        strcat(str[1],str[2]);
        format(str[3],1900,""COL_WHITE"Admin Level: "COL_LIGHTBLUE"%d \n"COL_WHITE"VIP Level: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Robberies: "COL_LIGHTBLUE"%d \n ", pinfo[id][Admin], pinfo[id][VIP], pinfo[id][TotalRobs]);
        strcat(str[1],str[3]);
        format(str[4],1900,""COL_WHITE"Robbery Skill: "COL_LIGHTBLUE"%d \n, "COL_WHITE"Hitman Skill: "COL_LIGHTBLUE"%d \n,"COL_WHITE"Terrorist Skill: "COL_LIGHTBLUE"%d \n "COL_WHITE"Total Time Played: "COL_LIGHTBLUE" [%d : %d ] \n", pinfo[id][Robskill], pinfo[id][Hitmanskill], pinfo[id][Terskill],pinfo[id][Hours],pinfo[id][Minutes]);
        strcat(str[1],str[4]);
        format(str[5],1900,"| ---------------------------------------------------- |");
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,dialog_stats,DIALOG_STYLE_MSGBOX,"Statistics",str[1],"OK","");
        return 1;
}
Try this :b
I don't think errormessages is the problem//
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)