06.02.2013, 00:58
Hello. My registration script worked fine until I added some fishing variables, and now when I register it doesn't create my new character row in MySQL. Here is the script:
pawn Код:
enum pInfo
{
pLevel,
pGender,
pCash,
pBank,
pJob,
pBirthDate,
pBirthMonth,
pBirthYear,
pAdminLevel,
pAdminDuty,
pSkin,
pFishPermit,
pFish[5],
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pPosA,
pRegistered
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
new query[350], pname[24], IP[15];
GetPlayerName(playerid, pname, 24);
GetPlayerIp(playerid, IP, 15);
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pGender] = 0;
PlayerInfo[playerid][pCash] = 300;
PlayerInfo[playerid][pBank] = 500;
PlayerInfo[playerid][pJob] = 0;
PlayerInfo[playerid][pBirthDate] = 0;
PlayerInfo[playerid][pBirthMonth] = 0;
PlayerInfo[playerid][pBirthYear] = 0;
PlayerInfo[playerid][pAdminLevel] = 0;
PlayerInfo[playerid][pAdminDuty] = 0;
PlayerInfo[playerid][pSkin] = 101;
PlayerInfo[playerid][pFishPermit] = 0;
PlayerInfo[playerid][pFish][0] = 0;
PlayerInfo[playerid][pFish][1] = 0;
PlayerInfo[playerid][pFish][2] = 0;
PlayerInfo[playerid][pFish][3] = 0;
PlayerInfo[playerid][pFish][4] = 0;
PlayerInfo[playerid][pPosX] = 1282;
PlayerInfo[playerid][pPosY] = 170;
PlayerInfo[playerid][pPosZ] = 20;
PlayerInfo[playerid][pPosA] = 338;
PlayerInfo[playerid][pRegistered] = 0;
format(query, sizeof(query), "INSERT INTO playerdata (Username, Password, Level, Gender, Cash, Bank, Job, BirthDate, BirthMonth, BirthYear, AdminLevel, AdminDuty, IP, Skin, FishPermit, FishA, FishB, FishC, FishD, FishE, PosX, PosY, PosZ, PosA, Registered) VALUES('%s', SHA1('%s'), %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %f, %f, %f, %f, %d)",
pname,
passwordstring,
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pGender],
PlayerInfo[playerid][pCash],
PlayerInfo[playerid][pBank],
PlayerInfo[playerid][pJob],
PlayerInfo[playerid][pBirthDate],
PlayerInfo[playerid][pBirthMonth],
PlayerInfo[playerid][pBirthYear],
PlayerInfo[playerid][pAdminLevel],
PlayerInfo[playerid][pAdminDuty],
IP,
PlayerInfo[playerid][pSkin],
PlayerInfo[playerid][pFishPermit],
PlayerInfo[playerid][pFish][0],
PlayerInfo[playerid][pFish][1],
PlayerInfo[playerid][pFish][2],
PlayerInfo[playerid][pFish][3],
PlayerInfo[playerid][pFish][4],
PlayerInfo[playerid][pPosX],
PlayerInfo[playerid][pPosY],
PlayerInfo[playerid][pPosZ],
PlayerInfo[playerid][pPosA],
PlayerInfo[playerid][pRegistered]);
mysql_query(query);
ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, ""Blue"Character Gender", ""White"Please select your characters gender from the options provided.", "Male", "Female");
return 1;
}