17.07.2013, 07:40
Код:
if(newkeys == KEY_SECONDARY_ATTACK) { for(new H=0;H<MAX_HOUSE;H++) { if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[H][Enterx],HouseInfo[H][Entery],HouseInfo[H][Enterz])) { if(HouseInfo[H][Chiuso] == 1) return SendClientMessage(playerid, COLOR_RED, "SERVER: Casa chiusa."); new string[128]; TogglePlayerControllable(playerid,0); SetTimerEx("sfreeze", 500, 0, "i", playerid); format(string, sizeof(string), "* apre la porta ed entra *",GetName(playerid)); SetPlayerChatBubble(playerid, string, 0xD6C3E3FF, 100.0, 5000); SendClientMessage(playerid, 0xD6C3E3FF, string); SetPlayerPos(playerid,HouseInfo[H][Exitx],HouseInfo[H][Exity],HouseInfo[H][Exitz]); SetPlayerVirtualWorld(playerid,H); SetPlayerInterior(playerid,HouseInfo[H][Interior]); return 1; } if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[H][Exitx],HouseInfo[H][Exity],HouseInfo[H][Exitz])) { new casa = GetPlayerVirtualWorld(playerid); if(HouseInfo[casa][Chiuso] == 1) return SendClientMessage(playerid, COLOR_RED, "SERVER: Casa chiusa."); new string[128]; TogglePlayerControllable(playerid,0); SetTimerEx("sfreeze", 500, 0, "i", playerid); format(string, sizeof(string), "* apre la porta ed esce *",GetName(playerid)); SetPlayerChatBubble(playerid, string, 0xD6C3E3FF, 100.0, 5000); SendClientMessage(playerid, 0xD6C3E3FF, string); SetPlayerPos(playerid,HouseInfo[H][Enterx],HouseInfo[H][Entery],HouseInfo[H][Enterz]); SetPlayerVirtualWorld(playerid,0); SetPlayerInterior(playerid,0); return 1; } } } else if(newkeys == KEY_WALK) { printf("key"); for(new H=0;H<MAX_HOUSE;H++) { printf("for"); if(IsPlayerInRangeOfPoint(playerid,3,HouseInfo[H][Enterx],HouseInfo[H][Enterx],HouseInfo[H][Enterz]) || IsPlayerInRangeOfPoint(playerid,3,HouseInfo[H][Exitx],HouseInfo[H][Exity],HouseInfo[H][Exitz])) { printf("dopoif"); if(HouseInfo[H][Venduto] == 1) return 1; if(PlayerInfo[playerid][Casa] != 0) return SendClientMessage(playerid,COLOR_RED,"SERVER: Possiedi gia' una casa."); if(PlayerInfo[playerid][Denaro] < HouseInfo[H][Costo]) return SendClientMessage(playerid,COLOR_RED,"SERVER: Non hai abbastanza soldi per comprare questa casa."); PlayerInfo[playerid][Denaro]-=HouseInfo[H][Costo]; SetPlayerMoney(playerid,PlayerInfo[playerid][Denaro]); PlayerInfo[playerid][Casa] = H; format(HouseInfo[H][Proprietario],24,"%s",GetName(playerid)); HouseInfo[H][Venduto] = 1; SendClientMessage(playerid,COLOR_GREEN,"SERVER: Casa acquistata con successo."); } } return 1; }
First off, sorry for the Italian language in the script but if you need something just ask.
Anyway.. I got this problem.. after the first if(newkeys, ecc. the second if doesn't work.. I tried putting some printf and it doesn't work (all the IF). I believe it could be some loop problem with the for..
Thanks for the help.