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];
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;
}
enum pInfo
{
pLevel,
pGender,
pCash,
pBank,
pJob,
pBirthDate,
pBirthMonth,
pBirthYear,
pAdminLevel,
pAdminDuty,
pSkin,
pFishPermit,
pFish,
pFish2,
pFish3,
pFish4,
pFish5,
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pPosA,
pRegistered
}
new PlayerInfo[MAX_PLAYERS][pInfo];
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],
PlayerInfo[playerid][pFish2],
PlayerInfo[playerid][pFish3],
PlayerInfo[playerid][pFish4],
PlayerInfo[playerid][pFish5],
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;
}
CMD:fish(playerid, params[])
{
new string[128], done, fish;
if(!IsPlayerLoggedIn(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not logged in.");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid, 2.0, 2103.9148, -103.5168, 2.2754))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not at a fishing spot.");
return 1;
}
if(PlayerInfo[playerid][pFish][0] < 1 && PlayerInfo[playerid][pFish][1] < 1 && PlayerInfo[playerid][pFish][2] < 1 && PlayerInfo[playerid][pFish][3] < 1 && PlayerInfo[playerid][pFish][4] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You cannot hold any more fish in your inventory.");
return 1;
}
PlayerInfo[playerid][pFish][done] = fish;
format(string, sizeof(string), "* %s attempts to fish off the jetty.", Name(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetTimerEx("FishingTime", 20000, false, "i", playerid);
return 1;
}
forward FishingTime(playerid);
public FishingTime(playerid)
{
new done, fish, string[256], query[300], pname[24];
GetPlayerName(playerid, pname, 24);
for(new i=0; i<5; i++) // Fish
{
if(!done)
{
if(!PlayerInfo[playerid][pFish][i]) done = i+1;
}
}
done = done-1;
fish = random(31)+10;
PlayerInfo[playerid][pFish][done] = fish;
format(query, sizeof(query), "UPDATE playerdata SET FishA=%d, FishB=%d, FishC=%d, FishD=%d, FishE=%d WHERE Username='%s'",
PlayerInfo[playerid][pFish][0],
PlayerInfo[playerid][pFish][1],
PlayerInfo[playerid][pFish][2],
PlayerInfo[playerid][pFish][3],
PlayerInfo[playerid][pFish][4],
pname);
mysql_query(query);
format(string, sizeof(string), "* %s has caught a %d lbs fish.", fish);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
new query[350] is not enough. It should be at least 500. The query without any values is 344 letters long. It'll be over 350 with values set.
|