|
|
#1 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
Alright, so the problem is this - If I want to save a string to player stats (sql), then it saves correctly, but whenever I log in again, the first character is gone.
I created a command called /setchatprefix which would show any text you want at the chat you write automatically, so when you set it, it saves to MySQL perfectly. I log out, MySQL still looks good, but when I log back in so the player stats are loaded, the first letter disappears. For example, if my prefix was 'British Accent', after I log in, I see 'ritish Accent'. The same problem is with MarriedTo actually, which is bugged by default in GodFather. Here's my script for the shit - Code:
public OnPlayerUpdate(playerid) // by Luk0r v1.2
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
MySQLCheckConnection();
new query[MAX_STRING];
format(query, MAX_STRING, "UPDATE players SET ");
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PlayerLevel", PlayerInfo[playerid][pLevel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "AdminLevel", PlayerInfo[playerid][pAdmin]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DonateRank", PlayerInfo[playerid][pDonateRank]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "UpgradePoints", PlayerInfo[playerid][gPupgrade]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "ConnectedTime", PlayerInfo[playerid][pConnectTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Registered", PlayerInfo[playerid][pReg]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Sex", PlayerInfo[playerid][pSex]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Age", PlayerInfo[playerid][pAge]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Origin", PlayerInfo[playerid][pOrigin]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CK", PlayerInfo[playerid][pCK]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Muted", PlayerInfo[playerid][pMuted]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Respect", PlayerInfo[playerid][pExp]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Money", PlayerInfo[playerid][pCash]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Bank", PlayerInfo[playerid][pAccount]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Crimes", PlayerInfo[playerid][pCrimes]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Kills", PlayerInfo[playerid][pKills]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Deaths", PlayerInfo[playerid][pDeaths]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Arrested", PlayerInfo[playerid][pArrested]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "WantedDeaths", PlayerInfo[playerid][pWantedDeaths]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Phonebook", PlayerInfo[playerid][pPhoneBook]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "LottoNr", PlayerInfo[playerid][pLottoNr]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Fishes", PlayerInfo[playerid][pFishes]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BiggestFish", PlayerInfo[playerid][pBiggestFish]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Job", PlayerInfo[playerid][pJob]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Paycheck", PlayerInfo[playerid][pPayCheck]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "HeadValue", PlayerInfo[playerid][pHeadValue]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Jailed", PlayerInfo[playerid][pJailed]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "JailTime", PlayerInfo[playerid][pJailTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Materials", PlayerInfo[playerid][pMats]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Drugs", PlayerInfo[playerid][pDrugs]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Leader", PlayerInfo[playerid][pLeader]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Member", PlayerInfo[playerid][pMember]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FMember", PlayerInfo[playerid][pFMember]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Rank", PlayerInfo[playerid][pRank]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Chara", PlayerInfo[playerid][pChar]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "ContractTime", PlayerInfo[playerid][pContractTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FightStyle", PlayerInfo[playerid][pFightStyle]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "SexSkill", PlayerInfo[playerid][pSexSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BoxSkill", PlayerInfo[playerid][pBoxSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "LicensePoints", PlayerInfo[playerid][pLicensePoints]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarParts", PlayerInfo[playerid][pCarParts]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "JackSkill", PlayerInfo[playerid][pJackSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarSkill", PlayerInfo[playerid][pCarSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ticket", PlayerInfo[playerid][pTicket]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DrugsSkill", PlayerInfo[playerid][pDrugsSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "SmuggleSkill", PlayerInfo[playerid][pSmuggleSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FishSkill", PlayerInfo[playerid][pFishSkill]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "pSHealth", PlayerInfo[playerid][pSHealth]);
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "pHealth", PlayerInfo[playerid][pHealth]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Inte", PlayerInfo[playerid][pInt]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Local", PlayerInfo[playerid][pLocal]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Team", PlayerInfo[playerid][pTeam]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Model", PlayerInfo[playerid][pModel]);
//MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Model", GetPlayerSkin(playerid));
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PhoneNr", PlayerInfo[playerid][pPnumber]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "House", PlayerInfo[playerid][pPhousekey]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Car", PlayerInfo[playerid][pPcarkey]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Car2", PlayerInfo[playerid][pPcarkey2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Car3", PlayerInfo[playerid][pPcarkey3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "InvWeapon", PlayerInfo[playerid][pInvWeapon]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Bizz", PlayerInfo[playerid][pPbiskey]);
if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
{
PlayerInfo[playerid][pPos_x] = 1684.9;
PlayerInfo[playerid][pPos_y] = -2244.5;
PlayerInfo[playerid][pPos_z] = 13.5;
}
if(Spectate[playerid] != 255)
{
PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
}
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_x", PlayerInfo[playerid][pPos_x]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_y", PlayerInfo[playerid][pPos_y]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_z", PlayerInfo[playerid][pPos_z]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarLic", PlayerInfo[playerid][pCarLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FlyLic", PlayerInfo[playerid][pFlyLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BoatLic", PlayerInfo[playerid][pBoatLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FishLic", PlayerInfo[playerid][pFishLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "GunLic", PlayerInfo[playerid][pGunLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun1", PlayerInfo[playerid][pGun1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun2", PlayerInfo[playerid][pGun2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun3", PlayerInfo[playerid][pGun3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun4", PlayerInfo[playerid][pGun4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo1", PlayerInfo[playerid][pAmmo1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo2", PlayerInfo[playerid][pAmmo2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo3", PlayerInfo[playerid][pAmmo3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo4", PlayerInfo[playerid][pAmmo4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarTime", PlayerInfo[playerid][pCarTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PayDay", PlayerInfo[playerid][pPayDay]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PayDayHad", PlayerInfo[playerid][pPayDayHad]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "InvAmmo", PlayerInfo[playerid][pInvAmmo]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Watch", PlayerInfo[playerid][pWatch]);
// MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Crashed", PlayerInfo[playerid][pCrashed]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Wins", PlayerInfo[playerid][pWins]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Loses", PlayerInfo[playerid][pLoses]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "AlcoholPerk", PlayerInfo[playerid][pAlcoholPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DrugPerk", PlayerInfo[playerid][pDrugPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MiserPerk", PlayerInfo[playerid][pMiserPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PainPerk", PlayerInfo[playerid][pPainPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "TraderPerk", PlayerInfo[playerid][pTraderPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Tutorial", PlayerInfo[playerid][pTut]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Mission", PlayerInfo[playerid][pMissionNr]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Warnings", PlayerInfo[playerid][pWarns]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "JobTime", PlayerInfo[playerid][pJobTime]);
//MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "VirWorld", PlayerInfo[playerid][pVirWorld]);
if(PlayerInfo[playerid][pDonateRank] < 1) { PlayerInfo[playerid][pFuel] = 0; }
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Fuel", PlayerInfo[playerid][pFuel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Married", PlayerInfo[playerid][pMarried]);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "MarriedTo", PlayerInfo[playerid][pMarriedTo]);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "ChatPrefix", PlayerInfo[playerid][pChatPrefix]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Badge", PlayerInfo[playerid][pBadge]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Cigarettes", PlayerInfo[playerid][pCigarettes]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FishTool", PlayerInfo[playerid][pFishTool]);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Lighter", PlayerInfo[playerid][pLighter]);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "FishTime", PlayerInfo[playerid][pFishTime]);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Mask", PlayerInfo[playerid][pMask]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "HouseKey", PlayerInfo[playerid][pPhousekey]);
MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
{
if(SpikeInfo[i][sCreated] == 1)
{
new panels, doors, lights123, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights123, tires);
tires = encode_tires(1, 1, 1, 1);
UpdateVehicleDamageStatus(carid, panels, doors, lights123, tires);
return 0;
}
}
}
if(GetPlayerState(playerid)==PLAYER_STATE_ONFOOT)
{
new weaponid=GetPlayerWeapon(playerid),oldweapontype=GetWeaponType(OldWeapon[playerid]);
new weapontype=GetWeaponType(weaponid);
if(HoldingWeapon[playerid]==weaponid)
StopPlayerHoldingObject(playerid);
if(OldWeapon[playerid]!=weaponid)
{
new modelid=GetWeaponModel(OldWeapon[playerid]);
if(modelid!=0 && oldweapontype!=WEAPON_TYPE_NONE && oldweapontype!=weapontype)
{
HoldingWeapon[playerid]=OldWeapon[playerid];
switch(oldweapontype)
{
case WEAPON_TYPE_LIGHT:
SetPlayerHoldingObject(playerid, modelid, 8,0.0,-0.1,0.15, -100.0, 0.0, 0.0);
case WEAPON_TYPE_MELEE:
SetPlayerHoldingObject(playerid, modelid, 7,0.0,0.0,-0.18, 100.0, 45.0, 0.0);
case WEAPON_TYPE_HEAVY:
SetPlayerHoldingObject(playerid, modelid, 1, 0.2,-0.125,-0.1,0.0,25.0,180.0);
}
}
}
if(oldweapontype!=weapontype)
OldWeapon[playerid]=weaponid;
}
}
}
return 1;
}
Code:
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
MySQLCheckConnection();
new tmp2[256];
new string2[64];
new playername2[MAX_PLAYER_NAME];
new playernamesplit[3][MAX_PLAYER_NAME];
new ipaddress[16];
GetPlayerName(playerid, playername2, sizeof(playername2));
GetPlayerIp(playerid, ipaddress, sizeof(ipaddress));
GetPlayerName(playerid, playername2, sizeof(playername2));
split(playername2, playernamesplit, '_');
MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
format(tmp2, sizeof(tmp2), "SELECT COUNT(*) FROM players WHERE Name='%s'", playername2);
samp_mysql_query(tmp2);
//if (DEBUG) SQLLog(tmp2);
samp_mysql_store_result();
samp_mysql_fetch_row(tmp2);
new registered = strval(tmp2);
if (registered < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not registered. Use /register <password> to create your user record.");
return 0;
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new Data[1024];
new Field[64];
new rcnt = 1;
MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
{
// The rcnt values here represent the order of the columns in the characters table, so don't mess with them
// If you add a column to the table, just add a new line with a +1 rcnt to the block below
// Start it at 3 to skip the first few records we don't need (id, player name, password)
if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
if (rcnt == 4) PlayerInfo[playerid][pAdmin] = strval(Field);
if (rcnt == 5) PlayerInfo[playerid][pDonateRank] = strval(Field);
if (rcnt == 6) PlayerInfo[playerid][gPupgrade] = strval(Field);
if (rcnt == 7) PlayerInfo[playerid][pConnectTime] = strval(Field);
if (rcnt == 8) PlayerInfo[playerid][pReg] = strval(Field);
if (rcnt == 9) PlayerInfo[playerid][pSex] = strval(Field);
if (rcnt == 10) PlayerInfo[playerid][pAge] = strval(Field);
if (rcnt == 11) PlayerInfo[playerid][pOrigin] = strval(Field);
if (rcnt == 12) PlayerInfo[playerid][pCK] = strval(Field);
if (rcnt == 13) PlayerInfo[playerid][pMuted] = strval(Field);
if (rcnt == 14) PlayerInfo[playerid][pExp] = strval(Field);
if (rcnt == 15) PlayerInfo[playerid][pCash] = strval(Field);
if (rcnt == 16) PlayerInfo[playerid][pAccount] = strval(Field);
if (rcnt == 17) PlayerInfo[playerid][pCrimes] = strval(Field);
if (rcnt == 18) PlayerInfo[playerid][pKills] = strval(Field);
if (rcnt == 19) PlayerInfo[playerid][pDeaths] = strval(Field);
if (rcnt == 20) PlayerInfo[playerid][pArrested] = strval(Field);
if (rcnt == 21) PlayerInfo[playerid][pWantedDeaths] = strval(Field);
if (rcnt == 22) PlayerInfo[playerid][pPhoneBook] = strval(Field);
if (rcnt == 23) PlayerInfo[playerid][pLottoNr] = strval(Field);
if (rcnt == 24) PlayerInfo[playerid][pFishes] = strval(Field);
if (rcnt == 25) PlayerInfo[playerid][pBiggestFish] = strval(Field);
if (rcnt == 26) PlayerInfo[playerid][pJob] = strval(Field);
if (rcnt == 27) PlayerInfo[playerid][pPayCheck] = strval(Field);
if (rcnt == 28) PlayerInfo[playerid][pHeadValue] = strval(Field);
if (rcnt == 29) PlayerInfo[playerid][pJailed] = strval(Field);
if (rcnt == 30) PlayerInfo[playerid][pJailTime] = strval(Field);
if (rcnt == 31) PlayerInfo[playerid][pMats] = strval(Field);
if (rcnt == 32) PlayerInfo[playerid][pDrugs] = strval(Field);
if (rcnt == 33) PlayerInfo[playerid][pLeader] = strval(Field);
if (rcnt == 34) PlayerInfo[playerid][pMember] = strval(Field);
if (rcnt == 35) PlayerInfo[playerid][pFMember] = strval(Field);
if (rcnt == 36) PlayerInfo[playerid][pRank] = strval(Field);
if (rcnt == 37) PlayerInfo[playerid][pChar] = strval(Field);
if (rcnt == 38) PlayerInfo[playerid][pContractTime] = strval(Field);
if (rcnt == 39) PlayerInfo[playerid][pFightStyle] = strval(Field);
if (rcnt == 40) PlayerInfo[playerid][pSexSkill] = strval(Field);
if (rcnt == 41) PlayerInfo[playerid][pBoxSkill] = strval(Field);
if (rcnt == 42) PlayerInfo[playerid][pLicensePoints] = strval(Field);
if (rcnt == 43) PlayerInfo[playerid][pCarParts] = strval(Field);
if (rcnt == 44) PlayerInfo[playerid][pJackSkill] = strval(Field);
if (rcnt == 45) PlayerInfo[playerid][pCarSkill] = strval(Field);
if (rcnt == 46) PlayerInfo[playerid][pTicket] = strval(Field);
if (rcnt == 47) PlayerInfo[playerid][pDrugsSkill] = strval(Field);
if (rcnt == 48) PlayerInfo[playerid][pSmuggleSkill] = strval(Field);
if (rcnt == 49) PlayerInfo[playerid][pFishSkill] = strval(Field);
if (rcnt == 50) PlayerInfo[playerid][pSHealth] = floatstr(Field);
if (rcnt == 51) PlayerInfo[playerid][pHealth] = floatstr(Field);
if (rcnt == 52) PlayerInfo[playerid][pInt] = strval(Field);
if (rcnt == 53) PlayerInfo[playerid][pLocal] = strval(Field);
if (rcnt == 54) PlayerInfo[playerid][pTeam] = strval(Field);
if (rcnt == 55) PlayerInfo[playerid][pModel] = strval(Field);
if (rcnt == 56) PlayerInfo[playerid][pPnumber] = strval(Field);
if (rcnt == 57) PlayerInfo[playerid][pPhousekey] = strval(Field);
if (rcnt == 58) PlayerInfo[playerid][pPcarkey] = strval(Field);
if (rcnt == 59) PlayerInfo[playerid][pPcarkey2] = strval(Field);
if (rcnt == 60) PlayerInfo[playerid][pPcarkey3] = strval(Field);
if (rcnt == 61) PlayerInfo[playerid][pInvWeapon] = strval(Field);
if (rcnt == 62) PlayerInfo[playerid][pPbiskey] = strval(Field);
if (rcnt == 63) PlayerInfo[playerid][pPos_x] = floatstr(Field);
if (rcnt == 64) PlayerInfo[playerid][pPos_y] = floatstr(Field);
if (rcnt == 65) PlayerInfo[playerid][pPos_z] = floatstr(Field);
if (rcnt == 66) PlayerInfo[playerid][pCarLic] = strval(Field);
if (rcnt == 67) PlayerInfo[playerid][pFlyLic] = strval(Field);
if (rcnt == 68) PlayerInfo[playerid][pBoatLic] = strval(Field);
if (rcnt == 69) PlayerInfo[playerid][pFishLic] = strval(Field);
if (rcnt == 70) PlayerInfo[playerid][pGunLic] = strval(Field);
if (rcnt == 71) PlayerInfo[playerid][pGun1] = strval(Field);
if (rcnt == 72) PlayerInfo[playerid][pGun2] = strval(Field);
if (rcnt == 73) PlayerInfo[playerid][pGun3] = strval(Field);
if (rcnt == 74) PlayerInfo[playerid][pGun4] = strval(Field);
if (rcnt == 75) PlayerInfo[playerid][pAmmo1] = strval(Field);
if (rcnt == 76) PlayerInfo[playerid][pAmmo2] = strval(Field);
if (rcnt == 77) PlayerInfo[playerid][pAmmo3] = strval(Field);
if (rcnt == 78) PlayerInfo[playerid][pAmmo4] = strval(Field);
if (rcnt == 79) PlayerInfo[playerid][pCarTime] = strval(Field);
if (rcnt == 80) PlayerInfo[playerid][pPayDay] = strval(Field);
if (rcnt == 81) PlayerInfo[playerid][pPayDayHad] = strval(Field);
if (rcnt == 82) PlayerInfo[playerid][pInvAmmo] = strval(Field);
if (rcnt == 83) PlayerInfo[playerid][pWins] = strval(Field);
if (rcnt == 84) PlayerInfo[playerid][pLoses] = strval(Field);
if (rcnt == 85) PlayerInfo[playerid][pAlcoholPerk] = strval(Field);
if (rcnt == 86) PlayerInfo[playerid][pDrugPerk] = strval(Field);
if (rcnt == 87) PlayerInfo[playerid][pMiserPerk] = strval(Field);
if (rcnt == 88) PlayerInfo[playerid][pPainPerk] = strval(Field);
if (rcnt == 89) PlayerInfo[playerid][pTraderPerk] = strval(Field);
if (rcnt == 90) PlayerInfo[playerid][pTut] = strval(Field);
if (rcnt == 91) PlayerInfo[playerid][pMissionNr] = strval(Field);
if (rcnt == 92) PlayerInfo[playerid][pWarns] = strval(Field);
if (rcnt == 93) PlayerInfo[playerid][pJobTime] = strval(Field);
if (rcnt == 94) PlayerInfo[playerid][pFuel] = strval(Field);
if (rcnt == 95) PlayerInfo[playerid][pMarried] = strval(Field);
if (rcnt == 96) PlayerInfo[playerid][pMarriedTo] = strmid(PlayerInfo[playerid][pMarriedTo], Field, 0, strlen(Field), 64);
if (rcnt == 97) PlayerInfo[playerid][pChatPrefix] = strmid(PlayerInfo[playerid][pChatPrefix], Field, 0, strlen(Field), 64);
if (rcnt == 98) PlayerInfo[playerid][pBadge] = strval(Field);
if (rcnt == 99) PlayerInfo[playerid][pCigarettes] = strval(Field);
if (rcnt == 100) PlayerInfo[playerid][pFishTool] = strval(Field);
if (rcnt == 101) PlayerInfo[playerid][pLighter] = strval(Field);
if (rcnt == 102) PlayerInfo[playerid][pWatch] = strval(Field);
if (rcnt == 103) PlayerInfo[playerid][pFishTime] = strval(Field);
if (rcnt == 104) PlayerInfo[playerid][pMask] = strval(Field);
if (rcnt == 105) PlayerInfo[playerid][pPhousekey] = strval(Field);
if (rcnt == 106) format(PlayerInfo[playerid][pStartIP], 16, "%s", Field);
if (rcnt == 107) format(PlayerInfo[playerid][pEndIP], 16, "%s", Field);
rcnt++;
}
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
return 1;
}
SafeResetPlayerMoney(playerid);
//ConsumingMoney[playerid] = 1;
//CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
SafeGivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
if(PlayerInfo[playerid][pReg] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pSHealth] = 0.0;
PlayerInfo[playerid][pHealth] = 50.0;
PlayerInfo[playerid][pPos_x] = -2615.1384;
PlayerInfo[playerid][pPos_y] = 2259.3462;
PlayerInfo[playerid][pPos_z] = 8.1983;
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pModel] = 48;
new randphone = 100000 + random(899999);//minimum 1000 max 9999 //giving one at the start
PlayerInfo[playerid][pPnumber] = randphone;
PlayerInfo[playerid][pPhousekey] = 255;
PlayerInfo[playerid][pPcarkey] = 999;
PlayerInfo[playerid][pPbiskey] = 255;
PlayerInfo[playerid][pAccount] = 0;
PlayerInfo[playerid][pReg] = 1;
SafeGivePlayerMoney(playerid, -200);
}
if(PlayerInfo[playerid][pLevel] == -999) //autoban
{
Ban(playerid);
}
else if(PlayerInfo[playerid][pCK] > 0)
{
Kick(playerid);
}
// Add an entry to the login log
new ipaddress2[16];
GetPlayerIp(playerid,ipaddress2,sizeof(ipaddress2));
MySQLAddLoginRecord(PlayerInfo[playerid][pSQLID], ipaddress2);
ClearChatbox(playerid, 8);
SendClientMessage(playerid, COLOR_LIGHTRED, "=============================================");
format(string2, sizeof(string2), "Welcome to Bayside, %s.",playernamesplit[0]);
SendClientMessage(playerid, COLOR_WHITE,string2);
SendClientMessage(playerid, COLOR_GREEN, "Server Owner: Vincenzo Alessio");
SendClientMessage(playerid, COLOR_GREEN, "Scripter: 666");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Forums: bayside-rp.tk");
format(string2, sizeof(string2), "Server is running script %s.",SCRIPT_VERSION);
SendClientMessage(playerid, COLOR_WHITE, string2);
if (PlayerInfo[playerid][pDonateRank] > 0)
{
SendClientMessage(playerid, COLOR_WHITE,"People of Bayside: Thank you for donating so we can live & build further improvements!");
}
if (PlayerInfo[playerid][pAdmin] > 0)
{
format(string2, sizeof(string2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,string2);
}
SendClientMessage(playerid, COLOR_GREEN, "=============================================");
SendClientMessage(playerid, COLOR_WHITE, " ");
printf("%s has logged in.",playername2);
FirstSpawn[playerid] = 1;
// Reset the FirstSpawn variable
//SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
// Set pCrashed variable
//SetTimerEx("SetCrashed", 5000, false, "i", playerid);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1.0, 1.0, -1, -1, -1, -1, -1, -1);
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
gPlayerLogged[playerid] = 1;
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
SpawnPlayer(playerid);
DateProp(playerid);
if(PlayerInfo[playerid][pFightStyle] == 1)
{
SetPlayerFightingStyle(playerid, 5);
}
else if(PlayerInfo[playerid][pFightStyle] == 2)
{
SetPlayerFightingStyle(playerid, 6);
}
else if(PlayerInfo[playerid][pFightStyle] == 3)
{
SetPlayerFightingStyle(playerid, 7);
}
else if(PlayerInfo[playerid][pFightStyle] == 4)
{
SetPlayerFightingStyle(playerid, 15);
}
else if(PlayerInfo[playerid][pFightStyle] == 5)
{
SetPlayerFightingStyle(playerid, 26);
}
else SetPlayerFightingStyle(playerid, 4);
new string11[128];
if(PlayerInfo[playerid][pMember] >= 1)
{
format(string11, sizeof(string11), "Family MOTD: %s",FamilyInfo[PlayerInfo[playerid][pMember]][FamilyMOTD]);
SendClientMessage(playerid,COLOR_YELLOW,string11);
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMaskuse] == 1)
{
ShowPlayerNameTagForPlayer(playerid, i, 0);
}
}
}
//}
return 1;
}
|
|
|
|
|
#2 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
Bump... Really need help about that, I just don't get it. Maybe it has something to do with strmid which I am unsure of how to use.
|
|
|
|
|
#3 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
Anybody at all?
|
|
|
|
|
#4 |
|
Big Clucker
![]() ![]() Join Date: Jul 2011
Posts: 180
Reputation: 1
|
Why don't you admins infract this guy and delete hes double posts it seems like u admins are against me. Coz you only give me infraction if i double post.
|
|
|
|
|
#5 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
|
|
|
|
|
#6 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: New Zealand
Posts: 3,020
Reputation: 371
|
I'm surprised your server isn't dead yet from sending like 150 queries on OnPlayerUpdate and never freeing a single result. That's just going to cause it to lag like crazy, could you please specify what string is screwing up. Also, can we see your MySQLUpdatePlayerStr function?
|
|
|
|
|
#7 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
Code:
public MySQLUpdatePlayerStr(query[], sqlplayerid, sqlvalname[], sqlupdatestr[]) // by Luk0r
{
MySQLUpdateBuild(query, sqlplayerid);
new escstr[128];
new updval[128];
samp_mysql_real_escape_string(sqlupdatestr, escstr);
format(updval, sizeof(updval), "%s='%s'", sqlvalname, escstr);
strcat(query, updval, MAX_STRING);
return 1;
}
Code:
if (rcnt == 96) PlayerInfo[playerid][pMarriedTo] = strmid(PlayerInfo[playerid][pMarriedTo], Field, 0, strlen(Field), 64); if (rcnt == 97) PlayerInfo[playerid][pChatPrefix] = strmid(PlayerInfo[playerid][pChatPrefix], Field, 0, strlen(Field), 64); Also, about what you said about the mysql querys and never freeing a result, when and where should I free the result? Can You point out where exactly should I add it? |
|
|
|
|
#8 |
|
Big Clucker
![]() ![]() Join Date: Aug 2010
Posts: 72
Reputation: 25
|
If there's someone that would like to try to help me out, it would be nice to add me in MSN - lammas455@hotmail.com. Also, you could PM me your own MSN because I got a problem with msn invites not showing me...
Thanks. |
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Loading a string with Dini? | lawonama | Help Archive | 9 | 18/07/2011 09:10 PM |
| Loading string from a file and inserting it into other string | Ivan_Pantovic | Help Archive | 0 | 06/02/2011 07:22 PM |
| [Scripting Help]Max chat string | Visualbr | Help Archive | 8 | 30/05/2010 11:47 AM |
| Adding prefix to a const string[] ? | dcmd_crash | Help Archive | 4 | 27/04/2010 11:23 PM |
| Loading a string from a file? | kevin433 | Help Archive | 2 | 15/02/2009 01:00 PM |