help with saving fish
#1

i followed this tutorial on fish https://sampforum.blast.hk/showthread.php?tid=342571

i had a problem saving with sql but in the past but i ended up fixing that couple days ago and i now know how to save with no problems

first problem is fish inventory command i cant get the names of fishes in the textdraw each fish has a type and its fishtype[playerid][fishslot]
i set all of those to return 0 because it want workin and ididnt want to delete the lines

Code:
dcmd_finv(playerid,params[])
{
	#pragma unused params
	HideTextDrawMenu(playerid);
	if (PlayerInfo[playerid][pSpawn] == 1)
	{
	new string[256],f1[128],f2[50],f3[10],f4[10],f5[50],f6[10],f7[10],f8[10],f9[50],f10[10],f11[10],f12[50],f13[10],f14[10],f15[10],f16[10],f17[50],f18[10],f19[10],f20[10];
	new fishslot;
	new fishname[]="FISH";
	
	
	if(FishType[playerid][fishslot] == 1)
	{
	return 0;
	}
	if(FishType[playerid][fishslot] == 2)
	{
	return 0;
	}
	if(FishType[playerid][fishslot] == 3)
	{
	return 0;
	}
	if(FishType[playerid][fishslot] == 4)
	{
	return 0;
	}
	if(FishType[playerid][fishslot] == 5)
	{
	return 0;
	}
	
	if (Fish[playerid][1] == 0)format(f1, sizeof(f1), "~r~None");else format(f1, sizeof(f1), "~p~%d LB %s",Fishlb[playerid][1],fishname);
	if (Fish[playerid][2] == 0)format(f2, sizeof(f2), "~r~None");else format(f2, sizeof(f2), "~p~%d LB %s",Fishlb[playerid][2],fishname);
	if (Fish[playerid][3] == 0)format(f3, sizeof(f3), "~r~None");else format(f3, sizeof(f3), "~p~%d LB %s",Fishlb[playerid][3],fishname);
	if (Fish[playerid][4] == 0)format(f4, sizeof(f4), "~r~None");else format(f4, sizeof(f4), "~p~%d LB %s",Fishlb[playerid][4],fishname);
	if (Fish[playerid][5] == 0)format(f5, sizeof(f5), "~r~None");else format(f5, sizeof(f5), "~p~%d LB %s",Fishlb[playerid][5],fishname);
	if (Fish[playerid][6] == 0)format(f6, sizeof(f6), "~r~None");else format(f6, sizeof(f6), "~p~%d LB %s",Fishlb[playerid][6],fishname);
	if (Fish[playerid][7] == 0)format(f7, sizeof(f7), "~r~None");else format(f7, sizeof(f7), "~p~%d LB %s",Fishlb[playerid][7],fishname);
	if (Fish[playerid][8] == 0)format(f8, sizeof(f8), "~r~None");else format(f8, sizeof(f8), "~p~%d LB %s",Fishlb[playerid][8],fishname);
	if (Fish[playerid][9] == 0)format(f9, sizeof(f9), "~r~None");else format(f9, sizeof(f9), "~p~%d LB %s",Fishlb[playerid][9],fishname);
	if (Fish[playerid][10] == 0)format(f10, sizeof(f10), "~r~None");else format(f10, sizeof(f10), "~p~%d LB %s",Fishlb[playerid][10],fishname);
	if (Fish[playerid][11] == 0)format(f11, sizeof(f11), "~r~None");else format(f11, sizeof(f11), "~p~%d LB %s",Fishlb[playerid][11],fishname);
	if (Fish[playerid][12] == 0)format(f12, sizeof(f12), "~r~None");else format(f12, sizeof(f12), "~p~%d LB %s",Fishlb[playerid][12],fishname);
	if (Fish[playerid][13] == 0)format(f13, sizeof(f13), "~r~None");else format(f13, sizeof(f13), "~p~%d LB %s",Fishlb[playerid][13],fishname);
	if (Fish[playerid][14] == 0)format(f14, sizeof(f14), "~r~None");else format(f14, sizeof(f14), "~p~%d LB %s",Fishlb[playerid][14],fishname);
	if (Fish[playerid][15] == 0)format(f15, sizeof(f15), "~r~None");else format(f15, sizeof(f15), "~p~%d LB %s",Fishlb[playerid][15],fishname);
	if (Fish[playerid][16] == 0)format(f16, sizeof(f16), "~r~None");else format(f16, sizeof(f16), "~p~%d LB %s",Fishlb[playerid][16],fishname);
	if (Fish[playerid][17] == 0)format(f17, sizeof(f17), "~r~None");else format(f17, sizeof(f17), "~p~%d LB %s",Fishlb[playerid][17],fishname);
	if (Fish[playerid][18] == 0)format(f18, sizeof(f18), "~r~None");else format(f18, sizeof(f18), "~p~%d LB %s",Fishlb[playerid][18],fishname);
	if (Fish[playerid][19] == 0)format(f19, sizeof(f19), "~r~None");else format(f19, sizeof(f19), "~p~%d LB %s",Fishlb[playerid][19],fishname);
	if (Fish[playerid][20] == 0)format(f20, sizeof(f20), "~r~None");else format(f20, sizeof(f20), "~p~%d LB %s",Fishlb[playerid][20],fishname);

	




	ShowTextDrawMenu(playerid, TD_MENU_INFO,"~g~Fish Inventory", 16, 0);

    format(string, sizeof(string), "%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s~n~%s",f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20);
	ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);


	}else{
	SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
	}
	return 1;
}


i just put fishname = fish because i tried to set it as
if fish type ==1
fishname[]= "Lobster";

and then if fishtype ==2
fishname[]= "Catfish";

and so on

would always get errors or when i did finaly got it to compile it would just say how much pounds no fish name


second problem is sql saving the fish

i know how to save with sql very little i just did it 2 timess but i made about 13 serperate columns in my playerdata and they all work

might sound silly but i made a save in sql for every fish for example

Code:
mysql_get_field("LSBombs",wdata);
lsbombs[playerid] = strval(wdata);

format(query,sizeof(query),"UPDATE playerdata SET LSBombs = '%d' WHERE UserName = '%s'",lsbombs[playerid],PlayerInfo[playerid][pName]);
mysql_query(query);
i saved my bombs with these codes it works on login and all that you get your bombs but now i need to get the fish to save

i tried saveing each fish duplicating lsbombs lines with fish1 fish2 fish3 fish4 fish5 all the way up i cant get them to save

no luck

i know its different because im not saving playinfo[playerid][pdrugs] i tried saving fish[playerid][fishslot] and each number individualy fish[playerid][1] and up cant seem to get it to work but i knew i would have a problem with this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)