SA-MP Forums Archive
House - 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 (/showthread.php?tid=664320)



House - EmpireSk - 25.02.2019

Hi,
I have edited a House System but I do not want to build a house as it is possible and could you help me?
I know to provide the entire House System....
Thanks


Re: House - EmpireSk - 25.02.2019

I have only edited the stock, but I can not build the houses and I do not build the cars


Re: House - EmpireSk - 25.02.2019

Quote:
Originally Posted by ******
Посмотреть сообщение
provide the entire House System….
I've already erased it house system...

But I have one problem here. I have a house number 200 to build a car Buffalo, that car belongs to the house 200..
But when I get in the car, it will show me that this car has its own EmpireSk... I can not get in the car even when I have a username EmpireSk...

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(!
IsPlayerNPC(playerid))
    {
        if(
IsPlayerConnected(playerid))
        {
                        if(!
ispassenger)
            {
                if(
IsPlayerConnected(playerid))
                {
                    for(new 
houseid;houseid<MAX_HOUSES;houseid++)
                    {
                        for(new 
x;x<HouseInfo[houseid][CarSlots];x++)
                        {
                            if(
vehicleid == Vehicle[houseid][x])
                            {
                                new 
HC GetPVarInt(playerid,"CarID");
                                new 
sa[128];
                                
format(sa,100,"VRLS/Houses/House%d.Car%d.txt",houseid,HC);
                                new 
blockmsg[128];
                                
format(blockmsg,128,"~r~WARNING~n~~n~~w~This vehicle belongs to the player:~n~~g~%s",DOF2_GetString(sa,"Owner"));
                                
FormatPlayerInfoBox(playerid,"~g~Virtual Reality",blockmsg,3000);
                                
StopPlayer(playerid);
                                return 
0;
                            }
                        }
                    }
                }
            }
        }
    }
    return 
1;




Re: House - Pottus - 25.02.2019

This killed me inside.

Код:
if(IsPlayerConnected(playerid)) 
        { 
                        if(!ispassenger) 
            { 
                if(IsPlayerConnected(playerid))
You don't any IsPlayerConnected() checks not one!

Also why would you return 0 in this callback? What if there is other systems that need to do work regardless if the player can enter a vehicle or not ?


Re: House - EmpireSk - 25.02.2019

One if(IsPlayerConnected(playerid)) is delete and return and I get back return 1... and did not do anything


Re: House - Pottus - 25.02.2019

Quote:
Originally Posted by EmpireSk
Посмотреть сообщение
One if(IsPlayerConnected(playerid)) is delete and return and I get back return 1... and did not do anything
BOTH! The player IS CONNECTED obviously! Why would you think of checking?


Re: House - EmpireSk - 25.02.2019

2x if(IsPlayerConnected(playerid)) is delete... But it still does not work


Re: House - Pottus - 25.02.2019

So start putting in lots of printf() functions and follow what is happening. Print all your variables etc. At the different times they change. It's really so easy shouldn't take more than 30 seconds to "rig" that code up.

I will tell you right now it is possible to eliminate both of those for loops with a couple lines of code.


Re: House - EmpireSk - 25.02.2019

I have tried to do it this way do.... But it works completely differently

I'm already desperate

PHP код:

if(!ispassenger)
        {
            for(new 
houseid;houseid<MAX_HOUSES;houseid++)
            {
                for(new 
x;x<HouseInfo[houseid][CarSlots];x++)
                {
                    if(
vehicleid == Vehicle[houseid][x])
                    {
                        new 
HC GetPVarInt(playerid,"CarID");
                        new 
sa[128];
                        
format(sa,100,"VRLS/Houses/House%d.Car%d.txt",houseid,HC);
                        if(!
DOF2_IsSet(sa,"Owner"))
                        {
                            new 
blockmsg[128];
                            
format(blockmsg,128,"~r~WARNING~n~~n~~w~This vehicle belongs to the player:~n~~g~%s",DOF2_GetString(sa,"Owner"));
                            
FormatPlayerInfoBox(playerid,"~g~Virtual Reality",blockmsg,3000);
                            
StopPlayer(playerid);
                            return 
1;
                        }
                    }
                }
            }
        } 



Re: House - SymonClash - 25.02.2019

Excuse me but your code is whole a mess. Hard to understand and painful to read.

What are you trying to do? What's the problem? Can you explain more?