House Keys help please..
#1

PHP код:
hasHouseKeys(playeridhouse) {
    new 
rent GetPVarInt(playerid"Rent");
    return 
Houses[house][EHouseOwnerSQLID] == GetPVarInt(playerid"CharID") || rent == Houses[house][EHouseSQLID];

PHP код:
new msg[128];
    if(
Houses[house][EHouseLocked] == 1) {
        
format(msgsizeof(msg), "* %s reaches over to %s pocket as he/she takes out a key, moving it to the door lock afterwards to unlock the door."GetPlayerNameEx(playeridENameType_RPName), getPossiveAdjective(playerid));
        
ProxMessage(15.0playeridmsgCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
GameTextForPlayer(playerid"~w~House ~g~Unlocked"50006);
        
PlayerPlaySound(playerid11450.00.00.0);
        
Houses[house][EHouseLocked] = 0;
    } else {
        
format(msgsizeof(msg), "* %s reaches over to %s pocket as he/she takes out a key, moving it to the door lock afterwards to lock the door.",  GetPlayerNameEx(playeridENameType_RPName), getPossiveAdjective(playerid));
        
ProxMessage(15.0playeridmsgCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
GameTextForPlayer(playerid"~w~House ~r~Locked"50006);
        
PlayerPlaySound(playerid11450.00.00.0);
        
Houses[house][EHouseLocked] = 1;
    }
    
saveHouseInfo(house);
    return 
1
PHP код:
if(!hasHouseKeys(playeridhouse) && GetPVarInt(playerid"Faction") != && GetPVarInt(playerid"Faction") != 1) {
        
SendClientMessage(playeridX11_TOMATO_2"This is not your house!");
        return 
1;
    } 
PHP код:
YCMD:givehousekeys(playeridparams[], help) {
    if(
help) {
        
SendClientMessage(playeridX11_WHITE"Gives house keys");
        return 
1;
    } 
Hey I want to create a cmd that gives house keys to the playerid player enters until he logs out.. using hashousekeys
Reply
#2

Any help atleast?
Reply
#3

Well we can't create the whole code, but atleast we can give you a Example,
First create a variable like this
PHP код:
new HaveRented[playerid]; 
Then add it in your command where just set HaveRented variable to 1, and now in which command you are checking that if a player is the owner of a house, he can enter/lock or anywhere you want, add this variable like
PHP код:
if(YourVariableOfCheckingthatisistheplayerhouse[playerid] == || if(HaveRented[playerid] == 1// if one of the situations is true it'll return to more code 
And now on
PHP код:
OnPlayerDisconnect(playerid
Change its value to 0,
So now this will gonna be a Temporary Rent system
Reply
#4

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
Well we can't create the whole code, but atleast we can give you a Example,
First create a variable like this
PHP код:
new HaveRented[playerid]; 
Then add it in your command where just set HaveRented variable to 1, and now in which command you are checking that if a player is the owner of a house, he can enter/lock or anywhere you want, add this variable like
PHP код:
if(YourVariableOfCheckingthatisistheplayerhouse[playerid] == || if(HaveRented[playerid] == 1// if one of the situations is true it'll return to more code 
And now on
PHP код:
OnPlayerDisconnect(playerid
Change its value to 0,
So now this will gonna be a Temporary Rent system
I don't want a rent system though.. I want if a player enters the command: givehousekeys[playerid].. it gives other player access to his house so he can /lock and unlock..
Reply
#5

Then create a variable in the top of your script OR add it to your player enums, and when the command is performed by the house owner, set that variable to the house's ID, and when the key receiver do /lock and the houseid is same as the value of that variable/enum then continue in the lock system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)