08.08.2016, 21:23
Hey guys. I am trying to make a system that basically stores a point in individual user files using DINI. I know dini is old and not really recommended by you guys to be used, but I've decided to do it just because some of the older scripts that I have lying around use it, and I'm trying to get a hang of it. I basically have the made it so that it stores the coordinates in individual files with the players name within a folder. The problem I have is however that anyone with any name can make use of that point, where it should only be the person that has the same name as on the dini file. In other words anyone can make use of the point one individually has put, where as I want it to be so that only people with the right name can make use of the point that has been set. How do I do that?
Code:
CMD:housepoint(playerid, params[]) { new file[256], name[24]; GetPlayerName(playerid, name, sizeof(name)); format(file,sizeof(file),"HousePoint/%s.ini",name); if(!fexist(file)) { new PlayerText3D:playertextid; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); playertextid = CreatePlayer3DTextLabel(playerid,"Housepoint",0x008080FF,X,Y,Z,40.0); dini_Create(file); HousePoint[playerid][PosX] = dini_Float(file, "X"); HousePoint[playerid][PosY] = dini_Float(file, "Y"); HousePoint[playerid][PosZ] = dini_Float(file, "Z"); HousePoint[playerid][PosX] = X; HousePoint[playerid][PosY] = Y; HousePoint[playerid][PosZ] = Z; dini_FloatSet(file, "X", HousePoint[playerid][PosX]); dini_FloatSet(file, "Y", HousePoint[playerid][PosY]); dini_FloatSet(file, "Z", HousePoint[playerid][PosZ]); //format(string1,sizeof(string1),"Position = X: %.0f , Y: %.0f , Z: %.0f",HousePoint[playerid][PosX],HousePoint[playerid][PosY],HousePoint[playerid][PosZ]); //SendClientMessage(playerid, -1, string1); SendClientMessage(playerid, -1, "You have set a house point!"); } else { SendClientMessage(playerid, -1, "You already have a house point!"); } return 1; } CMD:furniture(playerid, params[]) { if(!IsPlayerInRangeOfPoint(playerid, 4.0, HousePoint[playerid][PosX], HousePoint[playerid][PosY], HousePoint[playerid][PosZ])) return SendClientMessage(playerid, -1, "You are not at the area of your house point!"); ShowPlayerDialog(playerid, DIALOG_FURNITURE_MENU, DIALOG_STYLE_LIST, "Furnitures", "Buy Furniture\nEdit Furniture\nSell Furniture\nSell All Furnitures (admin only)", "Choose", "Back"); return 1; }