//...
enum pInfo
{
pPass,
pCash,
pAdmin,
pBeta,
pKills,
pDeaths,
pVip,
pBan,
pScore,
pSkin,
pNamecolor,
pBackpack,
pRcon,
pTutorial
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Beta",PlayerInfo[playerid][pBeta]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Vip",PlayerInfo[playerid][pVip]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Ban",PlayerInfo[playerid][pBan]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Namecolor",PlayerInfo[playerid][pNamecolor]);
INI_Int("Backpack",PlayerInfo[playerid][pBackpack]);
INI_Int("Rcon",PlayerInfo[playerid][pRcon]);
INI_Int("Tutorial",PlayerInfo[playerid][pTutorial]);
return 1;
}
//...
public OnPlayerConnect(playerid)
{
tutorial[playerid] = 0;
PlayerTutorial[playerid] = 0;
RemovePlayerAttachedObject(playerid, 1);
PlayerInfo[playerid][pBackpack] = 0;
PlayerInfo[playerid][pNamecolor] = 0;
PlayerInfo[playerid][pRcon] = 0;
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
if (PlayerInfo[playerid][pRcon] == 1)
{
SetPVarInt(playerid,"Rcon",1);
}
else
{
SetPVarInt(playerid,"Rcon",0);
}
if (PlayerInfo[playerid][pBan] == 1)
{
SendClientMessage(playerid,COLOR_RED, "You are banned from this server!");
SetTimer("BanTimer", 1000,false);
}
SpamCount[playerid]=0;
muted[playerid]=0;
if (ToggleBeta == 1)
{
if (PlayerInfo[playerid][pBeta] >= 1)
{
SetPVarInt(playerid,"Beta",1);
}
else if (PlayerInfo[playerid][pBeta] == 0)
{
SetPVarInt(playerid,"Beta",0);
}
}
else
{
SetPVarInt(playerid,"Beta",0);
}
return 1;
}
//...
public OnPlayerSpawn(playerid)
{
SendClientMessage(playerid, COLOR_ORANGE, "Press [N] to stop any music streams.");
PlayAudioStreamForPlayer(playerid,"http://k007.kiwi6.com/hotlink/djtq3f3gmh/Karaoke_Supermassive_Black_Hole_-_Muse_-.mp3");
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
//PLAYER COLORS
if (PlayerInfo[playerid][pNamecolor] == 0)
{
SetPlayerColor(playerid,COLOR_WHITE);
}
if (PlayerInfo[playerid][pNamecolor] == 1)
{
SetPlayerColor(playerid,COLOR_CYAN);
}
if (PlayerInfo[playerid][pNamecolor] == 2)
{
SetPlayerColor(playerid,COLOR_RED);
}
if (PlayerInfo[playerid][pNamecolor] == 3)
{
SetPlayerColor(playerid,COLOR_BLUE);
}
if (PlayerInfo[playerid][pNamecolor] == 4)
{
SetPlayerColor(playerid,COLOR_GREEN);
}
if (PlayerInfo[playerid][pNamecolor] == 5)
{
SetPlayerColor(playerid,COLOR_ORANGE);
}
if (PlayerInfo[playerid][pNamecolor] == 6)
{
SetPlayerColor(playerid,COLOR_DARKRED);
}
if (PlayerInfo[playerid][pNamecolor] == 7)
{
SetPlayerColor(playerid,COLOR_DARKBLUE);
}
if (PlayerInfo[playerid][pNamecolor] == 8)
{
SetPlayerColor(playerid,COLOR_DARKGREEN);
}
if (PlayerInfo[playerid][pNamecolor] == 9)
{
SetPlayerColor(playerid,COLOR_PINK);
}
if (PlayerInfo[playerid][pNamecolor] == 10)
{
SetPlayerColor(playerid,COLOR_VIOLET);
}
if (PlayerInfo[playerid][pNamecolor] == 11)
{
SetPlayerColor(playerid,COLOR_INDIGO);
}
// BACKPACKS
if (PlayerInfo[playerid][pBackpack] == 0)
{
SetPlayerVelocity(playerid,0.0,0.0,0.0);
SetPVarInt(playerid,"Backpack",0);
RemovePlayerAttachedObject(playerid, 1);
}
if (PlayerInfo[playerid][pBackpack] == 1)
{
SetPlayerVelocity(playerid,-0.1,0.0,0.0);
SetPVarInt(playerid,"Backpack",1);
SetPlayerAttachedObject( playerid, 1, 371, 1, 0.062752, -0.15, -0.003304, 4.555679, 89.955924, 359.699523, 1.000000, 1.000000, 1.000000 );
}
if (PlayerInfo[playerid][pBackpack] == 2)
{
SetPlayerVelocity(playerid,-0.25,0.0,0.0);
SetPVarInt(playerid,"Backpack",2);
SetPlayerAttachedObject( playerid, 1, 1310, 1, -0.15, -0.2, -0.003304, 4.555679, 89.955924, 359.699523, 1.000000, 1.000000, 1.000000 );
}
if (PlayerInfo[playerid][pBackpack] == 3)
{
SetPlayerVelocity(playerid,0.0,0.0,0.0);
SetPVarInt(playerid,"Backpack",3);
SetPlayerAttachedObject( playerid, 1, 3026, 1, -0.15, -0.089650, -0.003304, 0, 0, 0, 1.000000, 1.000000, 1.000000 );
}
return 1;
}
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
Try to use it this way. Also make sure you folder where you are saving user account have 775 premissions.
Код:
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid); |
Thanks for the help, but I don't think it worked. Backpacks seem to be working, but Player Colors are not.
|
//PLAYER COLORS
if (PlayerInfo[playerid][pNamecolor] == 0)
{
SetPlayerColor(playerid,COLOR_WHITE);
}
if (PlayerInfo[playerid][pNamecolor] == 1)
{
SetPlayerColor(playerid,COLOR_CYAN);
}
if (PlayerInfo[playerid][pNamecolor] == 2)
{
SetPlayerColor(playerid,COLOR_RED);
}
if (PlayerInfo[playerid][pNamecolor] == 3)
{
SetPlayerColor(playerid,COLOR_BLUE);
}
if (PlayerInfo[playerid][pNamecolor] == 4)
{
SetPlayerColor(playerid,COLOR_GREEN);
}
if (PlayerInfo[playerid][pNamecolor] == 5)
{
SetPlayerColor(playerid,COLOR_ORANGE);
}
if (PlayerInfo[playerid][pNamecolor] == 6)
{
SetPlayerColor(playerid,COLOR_DARKRED);
}
if (PlayerInfo[playerid][pNamecolor] == 7)
{
SetPlayerColor(playerid,COLOR_DARKBLUE);
}
if (PlayerInfo[playerid][pNamecolor] == 8)
{
SetPlayerColor(playerid,COLOR_DARKGREEN);
}
if (PlayerInfo[playerid][pNamecolor] == 9)
{
SetPlayerColor(playerid,COLOR_PINK);
}
if (PlayerInfo[playerid][pNamecolor] == 10)
{
SetPlayerColor(playerid,COLOR_VIOLET);
}
if (PlayerInfo[playerid][pNamecolor] == 11)
{
SetPlayerColor(playerid,COLOR_INDIGO);
}
Instead of using this try to use stock and switch. If backpacks are working i don't see a reason why the rest is not loading. Make sure to recheck your script for errors and make sure that players have saved color before they connect for the first time. Else there is nothing to load.
|
Recheck again how and when you load colors. Try to assign color to test player by command like /setcolorall then you can debug if code is being proccessed at all. Also use printf to debug lines that are suspicious. Maybe order of loading fails as you have too many IF statments at the time. Optimize your code and keep testing
|