SA-MP Forums Archive
Stats dialog - 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: Stats dialog (/showthread.php?tid=504429)



Stats dialog - vassilis - 04.04.2014

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


Re: Stats dialog - ChandraLouis - 04.04.2014

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


Re: Stats dialog - vassilis - 04.04.2014

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


Re: Stats dialog - ChandraLouis - 04.04.2014

Edited


Re: Stats dialog - vassilis - 04.04.2014

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


Re: Stats dialog - ChandraLouis - 04.04.2014

well, i just took that out from my Server GM


Re: Stats dialog - vassilis - 04.04.2014

Lol could someone help D:


Re: Stats dialog - EiresJason - 04.04.2014

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;
}



Re: Stats dialog - biker122 - 04.04.2014

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


Re: Stats dialog - vassilis - 04.04.2014

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//