My pInfo is this
pawn Код:
enum pInfo {
pw,
Level,
Admin,
Money,
pHouseKey,
pLeader,
pMember,
pFac,
pFacRank,
pFacLeader,
pFacDiv,
pFacDivLeader,
pWanted,
pWanted1[64],
pWanted2[64],
pWanted3[64],
pWanted4[64],
pWanted5[64],
pWanted6[64],
pArrested,
pPrison,
pPrisonTime,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
My OnPlayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
new file[255];
new pname[255];
new string[128];
GetPlayerName(playerid, pname, sizeof(pname));
pTazer[playerid] = 0;
format(file, sizeof(file), "Users/%s.ini", pname);
// Load files on Login
if(dini_Exists(file))
{
PlayerInfo[playerid][Level] = dini_Int(file, "Level");
PlayerInfo[playerid][pw] = dini_Int(file, "pw");
PlayerInfo[playerid][Admin] = dini_Int(file, "Admin");
PlayerInfo[playerid][Money] = dini_Int(file, "Money");
PlayerInfo[playerid][pFac] = dini_Int(file, "Fac");
PlayerInfo[playerid][pFacRank] = dini_Int(file, "FacRank");
PlayerInfo[playerid][pFacLeader] = dini_Int(file, "FacLeader");
PlayerInfo[playerid][pFacDiv] = dini_Int(file, "FacDiv");
PlayerInfo[playerid][pFacDivLeader] = dini_Int(file, "FacDivLeader");
PlayerInfo[playerid][pWanted] = dini_Int(file, "Wanted");
PlayerInfo[playerid][pWanted1] = dini_Int(file, "Wanted1");
PlayerInfo[playerid][pWanted2] = dini_Int(file, "Wanted2");
PlayerInfo[playerid][pWanted3] = dini_Int(file, "Wanted3");
PlayerInfo[playerid][pWanted4] = dini_Int(file, "Wanted4");
PlayerInfo[playerid][pWanted5] = dini_Int(file, "Wanted5");
PlayerInfo[playerid][pWanted6] = dini_Int(file, "Wanted6");
PlayerInfo[playerid][pArrested] = dini_Int(file, "Arrested");
PlayerInfo[playerid][pPrison] = dini_Int(file, "Prison");
PlayerInfo[playerid][pPrisonTime] = dini_Int(file, "PrisonTime");
ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_PASSWORD, "Login", "{FFFF00}Welcome Back \n {FFFFFF}Type in your password below to Login", "Confirm", "Exit");
// Login Messages
if(PlayerInfo[playerid][Admin] == 1)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 1 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][Admin] == 2)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 2 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][Admin] == 3)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 3 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][Admin] == 4)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 4 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][Admin] == 5)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 5 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][Admin] == 6)
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in, {FF0000} Level 6 Administrator", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
else
{
format(string, sizeof(string), "{FF0000}[LOGIN]:{FFFFFF} %s has logged in", pname);
SendClientMessageToAll(COLOR_WHITE, string);
}
}
else if(dini_Create(file))
{
ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_PASSWORD, "Register", "{FFFF00}Welcome \n {FFFFFF}Type your password below to begin.", "Confirm", "Exit");
SendClientMessage(playerid, 0xFFFFFF, "Welcome to Red County Roleplay Please Register!");
}
return 1;
}
My OnPlayerDisconnect:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[255];
new pname[255];
new score = GetPlayerScore(playerid);
new money = GetPlayerMoney(playerid);
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Users/%s.ini", pname);
if(dini_Exists(file))
{
dini_IntSet(file, "Level", score);
dini_IntSet(file, "Money", money);
dini_IntSet(file, "Admin", PlayerInfo[playerid][Admin]);
dini_IntSet(file, "Fac", PlayerInfo[playerid][pFac]);
dini_IntSet(file, "FacRank", PlayerInfo[playerid][pFacRank]);
dini_IntSet(file, "FacLeader", PlayerInfo[playerid][pFacLeader]);
dini_IntSet(file, "FacDiv", PlayerInfo[playerid][pFacDiv]);
dini_IntSet(file, "FacDivLeader", PlayerInfo[playerid][pFacDivLeader]);
dini_IntSet(file, "Wanted", PlayerInfo[playerid][pWanted]);
dini_IntSet(file, "Wanted1", PlayerInfo[playerid][pWanted1]);
dini_IntSet(file, "Wanted2", PlayerInfo[playerid][pWanted2]);
dini_IntSet(file, "Wanted3", PlayerInfo[playerid][pWanted3]);
dini_IntSet(file, "Wanted4", PlayerInfo[playerid][pWanted4]);
dini_IntSet(file, "Wanted5", PlayerInfo[playerid][pWanted5]);
dini_IntSet(file, "Wanted6", PlayerInfo[playerid][pWanted6]);
dini_IntSet(file, "Arrested", PlayerInfo[playerid][pArrested]);
dini_IntSet(file, "Prison", PlayerInfo[playerid][pPrison]);
dini_IntSet(file, "PrisonTime", PlayerInfo[playerid][pPrisonTime]);
}
// Leave Messages
new string[39 + MAX_PLAYER_NAME];
switch(reason)
{
case 0: format(string, sizeof(string), "[LEFT] {FFFFFF}%s has left the server. (Timeout)", pname);
case 1: format(string, sizeof(string), "[LEFT] {FFFFFF}%s has left the server. (Leaving)", pname);
case 2: format(string, sizeof(string), "[LEFT] {FFFFFF}%s has left the server. (Kicked/Banned)", pname);
}
SendClientMessageToAll(COLOR_RED, string);
return 1;
}
My OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
return 1;
}
I have a /setmoney command but dont think that is causing the problem, here it is anyway:
pawn Код:
CMD:setmoney(playerid, params[]) // Set Money Command
{
if(PlayerInfo[playerid][Admin] >= 3 || IsPlayerAdmin(playerid))
{
new id, money, str[84], victimname[28], adminname[28];
if (sscanf(params, "ui", id, money)) return SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /setmoney [id] [ammount]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_LIGHTRED, "AdmCmd: This player is not connected.");
SetPlayerMoney(id, money);
GetPlayerName(id, victimname, 28);
GetPlayerName(playerid, adminname, 28);
format(str,84,"You've received %d from admin %s [ID %d]", money, adminname, playerid);
SendClientMessage(id, COLOR_LIGHTBLUE, str);
new string[128];
format(string, sizeof(string), "[ADMIN COMMAND]: %s has set %s's money to %s.", adminname, playerid, money);
Log("logs/setmoney.log", string);
format(string, sizeof(string), "[ADMIN COMMAND]: %s has used /setmoney.", adminname);
Log("logs/admincommands.log", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use this command");
return 1;
}
}
Thats all the stuff to do with money.
Hope you can find an answer