#1

When i type: /stats i get Unknown command...

pawn Код:
CMD:stats(playerid, params[])
{
    Stats(playerid,playerid);
    return 1;
}



public Stats(playerid,targetid)
{
    new cash =  GetPlayerMoney(targetid);
    new admin = PlayerInfo[targetid][pAdmin];
    new level = PlayerInfo[targetid][Level];
    new exp = PlayerInfo[targetid][pExp];
    new kills = PlayerInfo[targetid][pKills];
    new death = PlayerInfo[targetid][pDeaths];
    new ratio = kills/death;
    new bd = PlayerInfo[targetid][bd];
    new account = PlayerInfo[targetid][Banka];
    new expa = level*4;
    new intir = GetPlayerInterior(targetid);
    new pla = PlayerInfo[targetid][Hour];
    //new Float:shealth = PlayerInfo[targetid][pSHealth];
    new Float:health;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(targetid, name, sizeof(name));
    GetPlayerHealth(targetid,health);
    new coordsstring[256];
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
    SendClientMessage(playerid, COLOR_WHITE,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Level: [%d] Money: [$%d] Bank: [$%d]", level, cash, account);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Exp: [%d/%d] Int: [%d] Kills: [%d] Deaths: [%d] Ratio: [%d]", exp, expa, intir, kills, death, ratio);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Admin: [%d] BD: [%d] Heal: [%d]", admin, bd, health, pla);
    SendClientMessage(playerid, Grey,coordsstring);
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
}
and i compile and dont get any error, did you now whats a problem, or can you give me something similarly that works
Reply
#2

pawn Код:
CMD:stats(playerid)
    return Stats(playerid,playerid);

public Stats(playerid,targetid)
{
    new cash =  GetPlayerMoney(targetid);
    new admin = PlayerInfo[targetid][pAdmin];
    new level = PlayerInfo[targetid][Level];
    new exp = PlayerInfo[targetid][pExp];
    new kills = PlayerInfo[targetid][pKills];
    new death = PlayerInfo[targetid][pDeaths];
    new ratio = kills/death;
    new bd = PlayerInfo[targetid][bd];
    new account = PlayerInfo[targetid][Banka];
    new expa = level*4;
    new intir = GetPlayerInterior(targetid);
    new pla = PlayerInfo[targetid][Hour];
    new Float:health;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(targetid, name, sizeof(name));
    GetPlayerHealth(targetid,health);
    new coordsstring[128];
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
    SendClientMessage(playerid, COLOR_WHITE,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Level: [%d] Money: [$%d] Bank: [$%d]", level, cash, account);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Exp: [%d/%d] Int: [%d] Kills: [%d] Deaths: [%d] Ratio: [%d]", exp, expa, intir, kills, death, ratio);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Admin: [%d] BD: [%d] Heal: [%d]", admin, bd, health, pla);
    SendClientMessage(playerid, Grey,coordsstring);
    return SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
}
if still crashing Debug it
Reply
#3

try put this from Stats function everything in command and than try!
Reply
#4

its not crashing, it dosent appears in game :SS

I debug it and nothing print :SS
Reply
#5

I don't understand why you need to arguments targetid and playerid?
Use only playerid for all (replacing "targetid" for "playerid") and removing the "targetid" argument in the public function and the declaration (forward ...)
Reply
#6

Try this:

pawn Код:
CMD:stats(playerid, params[])
{
    new cash =  GetPlayerMoney(targetid);
    new admin = PlayerInfo[targetid][pAdmin];
    new level = PlayerInfo[targetid][Level];
    new exp = PlayerInfo[targetid][pExp];
    new kills = PlayerInfo[targetid][pKills];
    new death = PlayerInfo[targetid][pDeaths];
    new ratio = kills/death;
    new bd = PlayerInfo[targetid][bd];
    new account = PlayerInfo[targetid][Banka];
    new expa = level*4;
    new intir = GetPlayerInterior(targetid);
    new pla = PlayerInfo[targetid][Hour];
    new Float:health;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(targetid, name, sizeof(name));
    GetPlayerHealth(targetid,health);
    new coordsstring[128];
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
    SendClientMessage(playerid, COLOR_WHITE,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Level: [%d] Money: [$%d] Bank: [$%d]", level, cash, account);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Exp: [%d/%d] Int: [%d] Kills: [%d] Deaths: [%d] Ratio: [%d]", exp, expa, intir, kills, death, ratio);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Admin: [%d] BD: [%d] Heal: [%d]", admin, bd, health, pla);
    SendClientMessage(playerid, Grey,coordsstring);
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    return 1;
}
Reply
#7

nope dosent work
Reply
#8

Targetid is not mentioned, try this:

Код:
CMD:stats(playerid, params[])
{
    new cash =  GetPlayerMoney(playerid);
    new admin = PlayerInfo[playerid][pAdmin];
    new level = PlayerInfo[playerid][Level];
    new exp = PlayerInfo[playerid][pExp];
    new kills = PlayerInfo[playerid][pKills];
    new death = PlayerInfo[playerid][pDeaths];
    new ratio = kills/death;
    new bd = PlayerInfo[playerid][bd];
    new account = PlayerInfo[playerid][Banka];
    new expa = level*4;
    new intir = GetPlayerInterior(playerid);
    new pla = PlayerInfo[playerid][Hour];
    new Float:health;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerHealth(playerid,health);
    new coordsstring[128];
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
    SendClientMessage(playerid, COLOR_WHITE,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Level: [%d] Money: [$%d] Bank: [$%d]", level, cash, account);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Exp: [%d/%d] Int: [%d] Kills: [%d] Deaths: [%d] Ratio: [%d]", exp, expa, intir, kills, death, ratio);
    SendClientMessage(playerid, Grey,coordsstring);
    format(coordsstring, sizeof(coordsstring), "Admin: [%d] BD: [%d] Heal: [%d]", admin, bd, health, pla);
    SendClientMessage(playerid, Grey,coordsstring);
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    return 1;
}
Reply
#9

i solved ti ty south rep added
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)