stats Command
#1

I Was Trying To Create A Stats Command but when i type /stats it gives me the message that it is an unknown command
pawn Код:
CMD:stats(playerid,params[])
{
    new name[MAX_PLAYER_NAME];GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    new isadmin[10],isvip[10];
    if(pInfo[playerid][AdminLevel] == 0){format(isadmin,10,"No");}else{format(isadmin,10,"Yes");}
    if(pInfo[playerid][VIPLevel] == 0){format(isvip,10,"No");}else{format(isvip,10,"Yes");}
    new line1[128];format(line1,128,"[------------------------------ %s ------------------------------]",name);
    new line2[128];format(line2,128,"Kills : %i     Deaths : %i     Suicides : %i     Ratio : %i",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][Suicides],pInfo[playerid][Kills]/pInfo[playerid][Deaths]);
    new line3[128];format(line3,128,"Money : %i      Score : %i     Rank : %i",pInfo[playerid][Money],pInfo[playerid][Scores],pInfo[playerid][Rank]+1);
    new line4[128];format(line4,128,"Play Time : %i Hours, %i Minutes, %i Seconds .",pInfo[playerid][Hour],pInfo[playerid][Min],pInfo[playerid][Sec]);
    new line5[125];format(line5,128,"Admin : %s     Admin Level : %i",isadmin,pInfo[playerid][AdminLevel]);
    new line6[125];format(line6,128,"VIP : %s     VIP Level : %i",isvip,pInfo[playerid][VIPLevel]);
    SendClientMessage(playerid,COLOR_GREEN,line1);
    SendClientMessage(playerid,COLOR_RED,line2);
    SendClientMessage(playerid,COLOR_RED,line3);
    SendClientMessage(playerid,COLOR_RED,line4);
    SendClientMessage(playerid,COLOR_RED,line5);
    SendClientMessage(playerid,COLOR_RED,line6);
    return 1;
}
Reply
#2

Use an administrator system!! I prefer JLadmin because JLadmin is my favorite and server stats will be saved! no need of these stats those stats will appear in dialog with [ Deaths/Kills/Score/ and more]
Reply
#3

Quote:
Originally Posted by WantedBot
Посмотреть сообщение
Use an administrator system!! I prefer JLadmin because JLadmin is my favorite and server stats will be saved! no need of these stats those stats will appear in dialog with [ Deaths/Kills/Score/ and more]
Yep, using an admin system is much better, plus the extra commands and etc.
I recommend MellAdmin
Reply
#4

Try it:
PHP код:
CMD:stats(playerid,params[])
{
    new    
name[MAX_PLAYER_NAME],string[80];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    
format(string,80,"[------------------------------ %s ------------------------------]",name);
    
SendClientMessage(playerid,COLOR_GREEN,string);
    
format(string,80,"Kills : %i     Deaths : %i     Suicides : %i     Ratio : %.f",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][Suicides],pInfo[playerid][Kills]/pInfo[playerid][Deaths]);
    
SendClientMessage(playerid,COLOR_RED,string);
    
format(string,80,"Money : %i      Score : %i     Rank : %i",pInfo[playerid][Money],pInfo[playerid][Scores],pInfo[playerid][Rank]+1);
    
SendClientMessage(playerid,COLOR_RED,string);
    
format(string,80,"Play Time : %i Hours, %i Minutes, %i Seconds .",pInfo[playerid][Hour],pInfo[playerid][Min],pInfo[playerid][Sec]);
    
SendClientMessage(playerid,COLOR_RED,string);
    
format(string,80,"Admin : %s     Admin Level : %i",pInfo[playerid][AdminLevel]?("Yes"):("No"),pInfo[playerid][AdminLevel]);
    
SendClientMessage(playerid,COLOR_RED,string);
    
format(string,80,"VIP : %s     VIP Level : %i",pInfo[playerid][VIPLevel]?("Yes"):("No"),pInfo[playerid][VIPLevel]);
    
SendClientMessage(playerid,COLOR_RED,string);
    return 
1;

Reply
#5

trying...
Reply
#6

just posts the first line and then sends server unknown command
Reply
#7

pawn Код:
CMD:stats(playerid,params[])
{
    new targetid;
    new    name[MAX_PLAYER_NAME],string[150];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,COLOR_GREY,"Syntax: /stats [playerid]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player is not online");
    format(string,80,"[------------------------------ %s ------------------------------]",name);
    SendClientMessage(playerid,COLOR_GREEN,string);
    format(string,80,"Kills : %d     Deaths : %d     Suicides : %d     Ratio : %.f",pInfo[targetid][Kills],pInfo[targetid][Deaths],pInfo[targetid][Suicides],pInfo[targetid][Kills]/pInfo[targetid][Deaths]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,80,"Money : %i      Score : %d     Rank : %d",pInfo[targetid][Money],pInfo[targetid][Scores],pInfo[targetid][Rank]+1);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,80,"Play Time : %d Hours, %d Minutes, %d Seconds .",pInfo[targetid][Hour],pInfo[targetid][Min],pInfo[targetid][Sec]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,80,"Admin : %s     Admin Level : %d",pInfo[targetid][AdminLevel]?("Yes"):("No"),pInfo[targetid][AdminLevel]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,80,"VIP : %s     VIP Level : %d",pInfo[targetid][VIPLevel]?("Yes"):("No"),pInfo[targetid][VIPLevel]);
    SendClientMessage(playerid,COLOR_RED,string);
    return 1;
}
Reply
#8

same Well You Added the param targetid so i can get any body's stats but the thing is it is the same when selecting my id ,so when i type this /stats 0(me) i get that line only
[---------------------Opah--------------------------]
And The Next line
Server: unknown command

idk what's wrong with it

but thanx for helping dude
Reply
#9

Opah

pawn Код:
CMD:stats(playerid,params[])
{
    new targetid;
    new    name[MAX_PLAYER_NAME],string[190];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,COLOR_GREY,"Syntax: /stats [playerid]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player is not online");
    format(string, sizeof(string), "[------------------------------ %s ------------------------------]",name);
    SendClientMessage(playerid,COLOR_GREEN,string);
    format(string, sizeof(string), "Kills : %d     Deaths : %d     Suicides : %d     Ratio : %.f",pInfo[targetid][Kills],pInfo[targetid][Deaths],pInfo[targetid][Suicides],pInfo[targetid][Kills]/pInfo[targetid][Deaths]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string, sizeof(string), "Money : %i      Score : %d     Rank : %d",pInfo[targetid][Money],pInfo[targetid][Scores],pInfo[targetid][Rank]+1);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string, sizeof(string), "Play Time : %d Hours, %d Minutes, %d Seconds .",pInfo[targetid][Hour],pInfo[targetid][Min],pInfo[targetid][Sec]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string, sizeof(string), "Admin : %s     Admin Level : %d",pInfo[targetid][AdminLevel]?("Yes"):("No"),pInfo[targetid][AdminLevel]);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string, sizeof(string), "VIP : %s     VIP Level : %d",pInfo[targetid][VIPLevel]?("Yes"):("No"),pInfo[targetid][VIPLevel]);
    SendClientMessage(playerid,COLOR_RED,string);
    return 1;
}
here is the right one
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)