SA-MP Forums Archive
House owner check - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: House owner check (/showthread.php?tid=647138)



House owner check - matje - 30.12.2017

I'm using
Код:
#include <YSI\y_ini>
to store player and house data. I have two folders in scriptfiles - Users, Houses.

My issue is that I do not know how to check if a player owns a specific house. I've tried this:

Код:
for(new b = 0; b < sizeof(hHouse); b++){
        if(hHouse[b][dHouseID] == PlayerInfo[playerid][HouseID]){
            SendClientMessage(playerid, -1, "This is your house.");
            return 1;
        }
        SendClientMessage(playerid, -1, "This is not your house.");
        return 1;
    }
Both dHouseID and HouseID (in seperate files) match, but it does not work.


Re: House owner check - Zeth - 30.12.2017

Current code is fine and yes this can be way to check.
There maybe problem when you are setting the house owner or during saving or loading.


Re: House owner check - matje - 30.12.2017

Is there a better way?
Do I need to create a loop for PlayerInfo, too?


Re: House owner check - Zeth - 30.12.2017

Quote:
Originally Posted by matje
Посмотреть сообщение
Is there a better way?
Do I need to create a loop for PlayerInfo, too?
No you dont need to as playerid should be already there as a parameter.


Re: House owner check - matje - 03.01.2018

You are right, there is an issue with loading the houses.
Could you please give me an example of looping through all house files and loading the houses from the House folder?


Re: House owner check - CodeStyle175 - 03.01.2018

well switch to mysql because ini is only usful for loading server settings.
but when building house, business or other big system, then ini is too slow for that and amounts are getting very big very fast.
and also owner checking is much much simpler with mysql then ini.
and also start using foreach because you dont have to fast time writing if statments into loops.


Re: House owner check - matje - 03.01.2018

Thank you for the suggsetions, Im going to look into mysql. Any recommended mysql tutorials?