/stats help
#1

Well, im trying to make a command with /stats, but all of them i get errors.....
pawn Код:
dcmd(stats,4,cmdtext);

    dcmd_stats(playerid,params[])
{
    new params[100]
    new string[128];
    new name[MAX_PLAYER_NAME],Cash;
    name = GetPlayerName(playerid, name, sizeof(name));
    playerid = strval(params);
    Cash = GetPlayerMoney(playerid);
    format(string, sizeof(string), "|Account| Name: %s | Kills: %d | Deaths: %d | Cash: %d",name, PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Cash]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
I try to use this command... and it wont work... Im a new scripter, new with Dcmd, but it wont work.. the errors and stuff i get:
Код:
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(230) : warning 217: loose indentation
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(287) : error 017: undefined symbol "dcmd_stats"
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(289) : error 017: undefined symbol "dcmd_stats"
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(290) : warning 217: loose indentation
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(292) : error 001: expected token: ";", but found "new"
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(293) : warning 219: local variable "Cash" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(294) : error 033: array must be indexed (variable "name")
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(296) : error 022: must be lvalue (non-constant)
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(293) : warning 203: symbol is never used: "Cash"
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(293 -- 301) : warning 225: unreachable code
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\filterscripts\Login-Register.pwn(293 -- 301) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
This is mostly all the information you really need...
--------------------------------------------------
pawn Код:
// I got this on the top of the script to define "dcmd":
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

//This is my PlayerInfo:
enum PlayerData
{
    Cash,
    AdminLevel,
    Name[MAX_PLAYER_NAME],
    IP[16],
    Registered,
    Password,
    LoggedIn,
    Autologin,
    Kills,
    Deaths
};
new PlayerInfo[MAX_PLAYERS][PlayerData];
if you need more information please tell me...
also, please dont be harsh, im new scripter and REALLY new to dcmd...
my english is bad too.

Thank you if you can help
Reply
#2

Try this.
Код:
enum PlayerData
{
	Cash,
	AdminLevel,
	Name[MAX_PLAYER_NAME],
	IP[16],
	Registered,
	Password,
	LoggedIn,
	Autologin,
	Kills,
	Deaths
}
Код:
dcmd_stats(playerid,params[])
{
	#pragma unused params
	new string[128];
	new name[MAX_PLAYER_NAME];
	PlayerInfo[playerid][Cash] = GetPlayerMoney(playerid);
	GetPlayerName(playerid, name, sizeof(name));
	format(string, sizeof(string), "|Account| Name: %s | Kills: %d | Deaths: %d | Cash: %d",name, PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Cash]);
	SendClientMessage(playerid, COLOR_GREEN, string);
	return 1;
}
Didn't test it. Hope it works.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)