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



:SS - Speed - 25.11.2011

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


Re: :SS - Pharrel - 25.11.2011

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


Re: :SS - System64 - 25.11.2011

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


Re: :SS - Speed - 27.11.2011

its not crashing, it dosent appears in game :SS

I debug it and nothing print :SS


Re: :SS - admantis - 27.11.2011

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 ...)


Re: :SS - Joshb93 - 27.11.2011

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



Re: :SS - Speed - 29.11.2011

nope dosent work


Re: :SS - TheBetaFox - 29.11.2011

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



Re: :SS - Speed - 29.11.2011

i solved ti ty south rep added