SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/04/2014, 11:29 AM   #1
vassilis
High-roller
 
vassilis's Avatar
 
Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,679
Reputation: 362
Default Stats dialog

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
vassilis is offline   Reply With Quote
Old 04/04/2014, 11:34 AM   #2
ChandraLouis
Banned
 
Join Date: Mar 2013
Location: Indonesia
Posts: 438
Reputation: 37
Default Re: Stats dialog

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
ChandraLouis is offline   Reply With Quote
Old 04/04/2014, 11:35 AM   #3
vassilis
High-roller
 
vassilis's Avatar
 
Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,679
Reputation: 362
Default Re: Stats dialog

lol so i will use strlen and sscanf...? this is wrong i guess?
vassilis is offline   Reply With Quote
Old 04/04/2014, 11:37 AM   #4
ChandraLouis
Banned
 
Join Date: Mar 2013
Location: Indonesia
Posts: 438
Reputation: 37
Default Re: Stats dialog

Edited
ChandraLouis is offline   Reply With Quote
Old 04/04/2014, 11:41 AM   #5
vassilis
High-roller
 
vassilis's Avatar
 
Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,679
Reputation: 362
Default Re: Stats dialog

Quote:
Originally Posted by ChandraLouis View Post
Edited
How this could be wrong i don't have anything wrong on the sscanf..
vassilis is offline   Reply With Quote
Old 04/04/2014, 11:48 AM   #6
ChandraLouis
Banned
 
Join Date: Mar 2013
Location: Indonesia
Posts: 438
Reputation: 37
Default Re: Stats dialog

well, i just took that out from my Server GM
ChandraLouis is offline   Reply With Quote
Old 04/04/2014, 11:49 AM   #7
vassilis
High-roller
 
vassilis's Avatar
 
Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,679
Reputation: 362
Default Re: Stats dialog

Lol could someone help D:
vassilis is offline   Reply With Quote
Old 04/04/2014, 11:55 AM   #8
EiresJason
Gangsta
 
Join Date: Mar 2013
Location: Dublin.
Posts: 685
Reputation: 76
Default Re: Stats dialog

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;
}
EiresJason is offline   Reply With Quote
Old 04/04/2014, 11:56 AM   #9
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: Stats dialog

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
biker122 is offline   Reply With Quote
Old 04/04/2014, 11:58 AM   #10
vassilis
High-roller
 
vassilis's Avatar
 
Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,679
Reputation: 362
Default Re: Stats dialog

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//
vassilis is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/stats in a dialog Drago987 Scripting Help 6 11/10/2013 09:23 PM
Stats in dialog Squirrel Scripting Help 6 25/03/2013 03:15 AM
Dialog stats TaLhA XIV Scripting Help 5 26/07/2012 11:54 PM


All times are GMT. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.