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; }
The problem I have is however that anyone with any name can make use of that point |
HousePoint[playerid][PosX] = dini_Float(file, "X"); HousePoint[playerid][PosY] = dini_Float(file, "Y"); HousePoint[playerid][PosZ] = dini_Float(file, "Z");
What do you mean by the part in bold. Give a code example of where a player can currently use the point of another player.
Because now, the only thing you have in the given code, is the creation of the file and the accessing of the personal point. EDIT: You don't need this when creating the point. Code:
HousePoint[playerid][PosX] = dini_Float(file, "X"); HousePoint[playerid][PosY] = dini_Float(file, "Y"); HousePoint[playerid][PosZ] = dini_Float(file, "Z"); |
//OnPlayerConnect new file[256], name[24]; GetPlayerName(playerid, name, sizeof(name)); format(file,sizeof(file),"HousePoint/%s.ini",name); if(!fexist(file)) { //The player does have a HousePoint already, so get the coordinates HousePoint[playerid][PosX] = dini_Float(file, "X"); HousePoint[playerid][PosY] = dini_Float(file, "Y"); HousePoint[playerid][PosZ] = dini_Float(file, "Z"); } else { //The player doesn't have a HousePoint yet, so reset the coordinates HousePoint[playerid][PosX] = 0.0; HousePoint[playerid][PosY] = 0.0; HousePoint[playerid][PosZ] = 0.0; } //Furniture command if(HousePoint[playerid][PosX] == 0.0 && HousePoint[playerid][PosY] == 0.0 && HousePoint[playerid][PosZ] == 0.0) { SendClientMessage(playerid, -1, "You don't have a house point yet! Use /housepoint to set a house point."); return 1; //Stop the command } //Other furniture code