Simple help me please -
Davz*|*Criss - 22.08.2011
Hey there guys!
Here is my enums
pawn Code:
//Enum
enum iDetails {
Pass,
Cash,
Score,
Kills,
Deaths,
AdminLevel,
DonationRank
};
new pInfo[MAX_PLAYERS][iDetails];
Stats cmd
pawn Code:
CMD:stats(playerid, params[])
{
new Kills = pInfo[playerid][Kills]);
//ShowPlayerDialog(playerid, 98202, DIALOG_STYLE_MSGBOX, "Stats!", "Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d", "Okay", "Exit");
return 1;
}
and the errors:
pawn Code:
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : warning 219: local variable "Kills" shadows a variable at a preceding level
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : error 001: expected token: ";", but found ")"
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : error 029: invalid expression, assumed zero
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : warning 215: expression has no effect
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : warning 204: symbol is assigned a value that is never used: "Kills"
607 line = new Kills = pInfo[playerid][Kills]);
Thanks for your help!
Re: Simple help me please -
PhoenixB - 22.08.2011
pawn Code:
CMD:stats(playerid, params[])
{
format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nLevel: %i\nKills: %i\nDeaths: %i", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"));
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
return 1;
}
Thats a basic stats command, you must define your Defines at the PlayerInfo system so they can DISPLAY for the player, the stats command ive given you above shows basic things such as PlayerMoney, PlayerLevel, Kills, Deaths without the need of iDetails.
Not forget to make a DIALOG_STATS etc, define it at the top of your script and OnDialogResponse make it, if you know etc.
Re: Simple help me please -
[MWR]Blood - 22.08.2011
Let me make it for you:
pawn Code:
CMD:stats(playerid, params[])
{
new string[200];
format(string,sizeof(string),"Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][DonationRank],pInfo[playerid][AdminLevel]
ShowPlayerDialog(playerid, 98202, DIALOG_STYLE_MSGBOX, "Stats!", string, "Okay", "Exit");
return 1;
}
You need a string to display variables.
Re: Simple help me please -
Davz*|*Criss - 22.08.2011
Thanks!
Now look at the stats command:
pawn Code:
CMD:stats(playerid, params[])
{
new Kills = pInfo[playerid][Kills];
new Deaths = pInfo[playerid][Deaths];
new VIP = pInfo[playerid][DonationRank];
new AdmLevel = pInfo[playerid][AdminLevel];
new string[200];
format(string,sizeof(string),"Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d",Kills,Deaths,VIP,AdmLevel");
ShowPlayerDialog(playerid, 98202, DIALOG_STYLE_MSGBOX, "Stats!", string, "Okay", "Exit");
return 1;
}
And the errors:
pawn Code:
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(607) : warning 219: local variable "Kills" shadows a variable at a preceding level
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(608) : warning 219: local variable "Deaths" shadows a variable at a preceding level
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(613) : error 037: invalid string (possibly non-terminated string)
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(613) : warning 215: expression has no effect
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(613) : error 001: expected token: ";", but found ")"
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(613) : error 029: invalid expression, assumed zero
C:\Users\Axme\Desktop\Server\gamemodes\SFTM.pwn(613) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
.
Re: Simple help me please -
[MWR]Blood - 22.08.2011
You already defined those in the enum.
You shouldn't define them again, so leave it just like I made it and everything should be okay!
Re: Simple help me please -
Davz*|*Criss - 22.08.2011
Lol alright your code works fine.
But look at your code something is missed up..
pawn Code:
CMD:stats(playerid, params[])
{
new string[200];
format(string,sizeof(string),"Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][DonationRank],pInfo[playerid][AdminLevel]
ShowPlayerDialog(playerid, 98202, DIALOG_STYLE_MSGBOX, "Stats!", string, "Okay", "Exit");
return 1;
}
Look:
pawn Code:
format(string,sizeof(string),"Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][DonationRank],pInfo[playerid][AdminLevel]
EDIT: It works fine but i was just showing you that yo missed something, And i rep+ both of you especially you Delux.
Thanks!
Re: Simple help me please -
[MWR]Blood - 22.08.2011
I must have missed it
pawn Code:
format(string,sizeof(string),"Total Kills: %d Total Deaths: %d VIP Level: %d Admin Level: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][DonationRank],pInfo[playerid][AdminLevel]);
I'm sorry!