House owner check
#1

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.
Reply
#2

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.
Reply
#3

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

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.
Reply
#5

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?
Reply
#6

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)