Quote:
Originally Posted by Cypress
The problem could be when you spawn the player after he enters his password to log in. For example if you are using SetSpawnInfo and it's skinid is set to 0, you will be spawning with CJ skin.
You should consider showing some code if you want to get help in a proper way, else we can't be guessing what you have done wrong in your code.
|
Hello thanks for the info regarding to this quoted "The problem could be when you spawn the player after he enters his password to log in"
Actually I found the problem and it was under onplayerconnect. So before I spawn, do any changes of my skin or log in, under onplayerconnect it has already been changed to 0, so even I logged in it will stay as skin 0. I wonder why because as you can see the value of Admin is still 6 it hasn't been change to 0. Maybe theres a problem with mysql loading database?
Код:
public OnPlayerConnect(playerid)
{
new Query[100];
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `Name` = '%s'",GetName(playerid));
mysql_function_query(cHandle, Query, true, "CheckIP", "d", playerid);
new Query1[100];
format(Query1,sizeof(Query1),"SELECT * FROM `users` WHERE `Name` = '%s'",GetName(playerid));
mysql_function_query(cHandle, Query1, true, "CheckAccount", "d", playerid);
SendClientMessageToAllEx(-1, ""WHITE"%s[%d] has joined the server!", GetName(playerid), playerid);
SendDeathMessage(INVALID_PLAYER_ID,playerid,200);
new joinMsg[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(joinMsg, sizeof(joinMsg), "04***[JOIN] 01[%d] %s has joined the server.", playerid, name);
IRC_GroupSay(groupID, IRC_CHANNEL, joinMsg);
new message[128];
format(message, sizeof(message), "04***[JOIN] 01[%d] %s has joined the server. (IP: %s)", playerid, GetName(playerid), GetIp(playerid));
IRC_GroupSay(groupIDA, IRC_ADMIN_CHANNEL, message);
DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
TextDrawAlignment(DescriptionText[playerid], 2);
TextDrawFont(DescriptionText[playerid], 1);
TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
TextDrawSetOutline(DescriptionText[playerid], 1);
TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
indm[playerid] = 0;
stunt[playerid] = 0;
toggoto[playerid] = 0;
togbring[playerid] = 0;
freezed[playerid] = 0;
blockcmds[playerid] = 0;
muted[playerid] = 0;
induel[playerid] = 0;
watchduel[playerid] = 0;
togduel[playerid] = 0;
inviter[playerid] = 0;
invite[playerid] = 0;
ewatch[playerid] = 0;
LastSender[playerid] = -1;
DuelSender[playerid] = -1;
hayparkourspawn[playerid] = 0;
rwdmspawn[playerid] = 0;
wwdmspawn[playerid] = 0;
deagledmspawn[playerid] = 0;
boxdmspawnok[playerid] = 0;
builddmspawn[playerid] = 0;
racespawnok[playerid] = 0;
TextsActive[playerid] = 0;
PlayerSeconds[playerid] = 0;
inbikec[playerid] = 0;
inbikec2[playerid] = 0;
inbp1[playerid] = 0;
inbp2[playerid] = 0;
inparkour1[playerid] = 0;
inhayparkour[playerid] = 0;
inbikecmap[playerid] = 0;
inbikec2map[playerid] = 0;
inparkour[playerid] = 0;
readpms[playerid] = 0;
rcpoint[playerid] = -1;
racestarted[playerid] = 0;
EnableBoost[playerid] = 0;
g_antifall[playerid] = false;
g_bump[playerid] = false;
g_veh[playerid] = -1;
SpeedBoostMultiplier[playerid] = 1.2;
Better[playerid] = 0;
return 1;
}
Код:
public LoginPlayer(playerid)
{
new rows, fields;
cache_get_data(rows, fields, cHandle);
if(rows)
{
new mHolder[500];
cache_get_field_content(0, "Admin", mHolder, cHandle);
PlayerInfo[playerid][Admin] = strval(mHolder);
cache_get_field_content(0, "Founder", mHolder, cHandle);
PlayerInfo[playerid][Founder] = strval(mHolder);
cache_get_field_content(0, "Score", mHolder, cHandle);
PlayerInfo[playerid][Score] = strval(mHolder);
SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
cache_get_field_content(0, "Skin", mHolder, cHandle);
PlayerInfo[playerid][Skin] = strval(mHolder);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
cache_get_field_content(0, "Money", mHolder, cHandle);
PlayerInfo[playerid][Money] = strval(mHolder);
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
cache_get_field_content(0, "Deaths", mHolder, cHandle);
PlayerInfo[playerid][Deaths] = strval(mHolder);
cache_get_field_content(0, "Kills", mHolder, cHandle);
PlayerInfo[playerid][Kills] = strval(mHolder);
cache_get_field_content(0, "Banned", mHolder, cHandle);
PlayerInfo[playerid][Banned] = strval(mHolder);
cache_get_field_content(0, "RegDate", mHolder, cHandle);
format(regdate, sizeof(regdate),"%s", mHolder);
PlayerInfo[playerid][RegDate] = strval(mHolder);
cache_get_field_content(0, "RGB", mHolder, cHandle);
SetPlayerColor(playerid, strval(mHolder));
SetPlayerColourAlpha(playerid,500);
cache_get_field_content(0, "TextCol", mHolder, cHandle);
TextsActive[playerid] = strval(mHolder);
cache_get_field_content(0, "God", mHolder, cHandle);
god[playerid] = strval(mHolder);
if(god[playerid] == 1)
{
SetPlayerHealth(playerid,99999);
}
if(god[playerid] == 0)
{
SetPlayerHealth(playerid,100);
}
cache_get_field_content(0, "GodCar", mHolder, cHandle);
AutoRepair[playerid] = strval(mHolder);
if(AutoRepair[playerid] == 1)
{
FixTimer = SetTimer("FixCar",1000,true);
}
if(AutoRepair[playerid] == 0)
{
KillTimer(FixTimer);
}
cache_get_field_content(0, "TimeOnline", mHolder, cHandle);
PlayerInfo[playerid][TimeOnline] = strval(mHolder);
playerOnline[playerid] = gettime();
new Query[100];
format(Query,sizeof(Query),"UPDATE `users` SET `IP` = '%s' WHERE `Name` = '%s'",GetIp(playerid),GetName(playerid));
mysql_function_query(cHandle, Query, false, "", "d", playerid);
SendClientMessageEx(playerid, -1 , ""RED"[LOGIN] "WHITE"Welcome back, %s! You are now logged in.", GetName(playerid));
SendClientMessage(playerid, -1 , ""RED"[HELP] "WHITE"Type /cmds to access the current commands in our server!");
}
}
MYSQL LOG
Quote:
[23:39:39] >> mysql_connect(localhost, root, test, ******) on port 3306
[23:39:39] CMySQLHandler::CMySQLHandler() - constructor called.
[23:39:39] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "tes" | Username: "root"
[23:39:39] CMySQLHandler::Connect() - Connection was successful.
[23:39:39] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[23:39:39]
[23:39:39] ** MySQL Debugging enabled (12/08/14)
[23:39:39]
[23:39:39] >> mysql_connect(localhost, root, test, ******) on port 3306
[23:39:39] CMySQLHandler::Connect() - Connection was successful.
[23:39:39] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[23:39:44] >> mysql_query_callback( Connection handle: 1 )
[23:39:44] >> mysql_query_callback( Connection handle: 1 )
[23:39:44] Passing query SELECT * FROM `users` WHERE `Name` = 'Kevs' | d
[23:39:44] ProcessQueryThread(CheckIP) - Query was successful. (SELECT * FROM `users` WHERE `Name` = 'Kevs')
[23:39:44] ProcessQueryThread(CheckIP) - Data caching enabled.
[23:39:44] CMySQLHandler::StoreResult() - Result was stored.
[23:39:44] CMySQLHandler::FreeResult() - Result was successfully free'd.
[23:39:44] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[23:39:44] CheckIP(d) - Threaded function called.
[23:39:44] >> cache_get_data( Connection handle: 1 )
[23:39:44] ProcessTick() - The cache has been cleared.
[23:39:44] Passing query SELECT * FROM `users` WHERE `Name` = 'Kevs' | d
[23:39:44] ProcessQueryThread(CheckAccount) - Query was successful. (SELECT * FROM `users` WHERE `Name` = 'Kevs')
[23:39:44] ProcessQueryThread(CheckAccount) - Data caching enabled.
[23:39:44] CMySQLHandler::StoreResult() - Result was stored.
[23:39:44] CMySQLHandler::FreeResult() - Result was successfully free'd.
[23:39:44] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[23:39:44] CheckAccount(d) - Threaded function called.
[23:39:44] >> cache_get_data( Connection handle: 1 )
[23:39:44] ProcessTick() - The cache has been cleared.
[23:39:45] >> mysql_query_callback( Connection handle: 1 )
[23:39:45] Passing query UPDATE `users` SET `Admin` = '0', `Founder` = '0', `Money` = '0', `Score` = '0', `Kills` = '0', `Deaths` = '0', `Skin` = '0', `IP` = '192.168.2.103', `TimeOnline` = '1418067585', `Days` = '16412', `Hours` = '19', `Minutes` = '39' WHERE `Name` = 'Kevs' | d
[23:39:45] ProcessQueryThread() - Query was successful. (UPDATE `users` SET `Admin` = '0', `Founder` = '0', `Money` = '0', `Score` = '0', `Kills` = '0', `Deaths` = '0', `Skin` = '0', `IP` = '192.168.2.103', `TimeOnline` = '1418067585', `Days` = '16412', `Hours` = '19', `Minutes` = '39' WHERE `Name` = 'Kevs')
[23:39:45] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[23:39:45] (d) - Threaded function called.
[23:39:46] >> mysql_query_callback( Connection handle: 1 )
[23:39:46] Passing query UPDATE `users` SET `Admin` = '0', `Founder` = '0', `Money` = '0', `Score` = '0', `Kills` = '0', `Deaths` = '0', `Skin` = '0', `IP` = '192.168.2.103', `TimeOnline` = '1418067586', `Days` = '16412', `Hours` = '19', `Minutes` = '39' WHERE `Name` = 'Kevs' | d
[23:39:46] ProcessQueryThread() - Query was successful. (UPDATE `users` SET `Admin` = '0', `Founder` = '0', `Money` = '0', `Score` = '0', `Kills` = '0', `Deaths` = '0', `Skin` = '0', `IP` = '192.168.2.103', `TimeOnline` = '1418067586', `Days` = '16412', `Hours` = '19', `Minutes` = '39' WHERE `Name` = 'Kevs')
[23:39:46] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
|