12.07.2014, 21:55
Hi guys,
I'm making an int selection system. In this system, when a player buy a house, they will be teleported to house ints, and he has a Button " Select". When select the int, his house will be with the interior that he selected.
But I have a problem. I don't know how to put the int in the house that player bought. That's some like GetPlayerHouseID, but I don't know how to make it. Can you help me?
Here is some script of the system:
PS: Sorry for my bad English.
I'm making an int selection system. In this system, when a player buy a house, they will be teleported to house ints, and he has a Button " Select". When select the int, his house will be with the interior that he selected.
But I have a problem. I don't know how to put the int in the house that player bought. That's some like GetPlayerHouseID, but I don't know how to make it. Can you help me?
Here is some script of the system:
Код:
if(strcmp(cmd, "/comprarcasa", true) == 0) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); GetPlayerPos(playerid, oldposx, oldposy, oldposz); for(new h = 0; h < sizeof(Houses); h++) { if(PlayerToPoint(2.0, playerid, Houses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == 0) { if(Houses[h][HousePrice] == 0) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "*{FF0000} Erro:{FFFFFF} O preco da casa nao foi escolhido, poder nao ser para uso."); return 1; } if(PlayerInfo[playerid][pHouseKey] != 255 && strcmp(playername, Houses[PlayerInfo[playerid][pHouseKey]][Owner], true) == 0) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "*{FF0000} Erro:{FFFFFF} Apenas poderas ter uma casa, para compares uma nova, teras que vernder a tua acutal primeiro."); return 1; } if(Houses[h][Owned] == 1) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "*{FF0000} Erro:{FFFFFF} Casa Jб tem Dono."); return 1; } if(GetPlayerEuros(playerid) >= Houses[h][HousePrice]) { if(PlayerInfo[playerid][pescritura] == 1) { PlayerInfo[playerid][pescritura] = 0; PlayerInfo[playerid][pHouseKey] = h; PlayerInfo[playerid][pAluguer] = 0; Houses[h][Owned] = 1; Houses[h][Money] = 0; strmid(Houses[h][Owner], playername, 0, strlen(playername), 255); GivePlayerEuros(playerid,-Houses[h][HousePrice]); TextDrawShowForPlayer(playerid, HouseInt[playerid][3]); TextDrawShowForPlayer(playerid, HouseInt[playerid][4]); TextDrawShowForPlayer(playerid, HouseInt[playerid][5]); TextDrawShowForPlayer(playerid, HouseInt[playerid][6]); TextDrawShowForPlayer(playerid, HouseInt[playerid][7]); TextDrawShowForPlayer(playerid, HouseInt[playerid][8]); TextDrawSetSelectable(HouseInt[playerid][5], 1); TextDrawSetSelectable(HouseInt[playerid][8], 1); SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]); SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "*{CCCC00} Info:{FFFFFF} Compraste com sucesso a tua casa!"); PlayerActionMessage(playerid,15.0,"entrega uma mala cheia de dinheiro б agencia imobliaria, que dao em troca a chave da casa."); ChangeStreamPickupModel(Houses[h][PickupID],1239); SaveHouses(); UpdateHouses(h); OnPlayerDataSave(playerid); return 1; } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Tens de tratar da papelada na camara municipal!"); return 1; } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "*{FF0000} Erro:{FFFFFF} Nao tens dinheiro suficiente!"); return 1; } } } } return 1; }
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid) { if(clickedid == HouseInt[playerid][5] { SetPlayerCameraPos(playerid, 125,125,125); TextDrawHideForPlayer(playerid, HouseInt[playerid][2]); TextDrawHideForPlayer(playerid, HouseInt[playerid][5]); TextDrawHideForPlayer(playerid, HouseInt[playerid][8]); TextDrawShowForPlayer(playerid, HouseInt[playerid][9]); TextDrawShowForPlayer(playerid, HouseInt[playerid][10]); TextDrawShowForPlayer(playerid, HouseInt[playerid][11]); } if(clickedid == HouseInt[playerid][8] { Houses[id][ExitX] = 223.043991; Houses[id][ExitY] = 1289.259888; Houses[id][ExitZ] = 1082.199951; Houses[id][ExitInterior] = 1; } return 1; }