Scripting Help ( House System)
#1

I need help with a House System I am making, I am stuck at the "making commands" Part of it, if anyone can help me, heres the script >
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <Dini>

#define MAX_HOUSES 100

#define COLOR_WHITE 0xFFFFFFAA //White color
#define COLOR_RED 0xFF0000AA //Red Color
#define COLOR_GREEN 0x00FF00AA //Green color

forward UpdatePlayersHouseInfo();

enum hInfo
{
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInsideInt,
    hInsideVir,
    hOutsideInt,
    hOutsideVir,
    bool:hOwned,
    hOwner[MAX_PLAYER_NAME],
    hPrice,
    hPickup,
    hIcon,
    hVecModel,
    Float:hVecX,
    Float:hVecY,
    Float:hVecZ,
    Float:hVecA
};

new HouseInfo[MAX_HOUSES][hInfo];
new HouseCar[MAX_HOUSES];

stock LoadHouse(houseid)
{
new fstring[10]; //The string for the file [format]
format(fstring, 10, "Houses/%d", houseid); //Format the filename
if(!dini_Exists(fstring)) return 0;
HouseInfo[houseid][hEnterX] = dini_Float(fstring, "EnterX");
HouseInfo[houseid][hEnterY] = dini_Float(fstring, "EnterY");
HouseInfo[houseid][hEnterZ] = dini_Float(fstring, "EnterZ");
HouseInfo[houseid][hExitX] = dini_Float(fstring, "ExitX");
HouseInfo[houseid][hExitY] = dini_Float(fstring, "ExitY");
HouseInfo[houseid][hExitZ] = dini_Float(fstring, "ExitZ");
HouseInfo[houseid][hInsideInt] = dini_Int(fstring, "InsideInt");
HouseInfo[houseid][hInsideVir] = dini_Int(fstring, "InsideVir");
HouseInfo[houseid][hOutsideInt] = dini_Int(fstring, "OutsideInt");
HouseInfo[houseid][hOUtsideVir] = dini_Int(fstring, "OutsideVir");
HouseInfo[houseid][hOwned] = dini_Bool(fstring, "Owned") ? true : false; //Because it is an boolean: ? true : false;
strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get("Owner"))); //Used this one instead of {string} = {string}. I've ever read that this is faster
HouseInfo[houseid][hPrice] = dini_Int(fstring, "Price");
HouseInfo[houseid][hVecModel] = dini_Int(fstring, "HV_Model");
HouseInfo[houseid][hVecX] = dini_Float(fstring, "HV_PosX");
HouseInfo[houseid][hVecY] = dini_Float(fstring, "HV_PosZ");
HouseInfo[houseid][hVecZ] = dini_Float(fstring, "HV_PosZ");
HouseInfo[houseid][hVecA] = dini_Float(fstring, "HV_PosA");
return 1;
}
stock LoadHouseVisual(houseid, bool:reload = false)
{
if(reload)
{
    DestroyDynamicMapIcon(HouseInfo[houseid][hIcon]);
    DestroyDynamicPickup(HouseInfo[houseid][hPickup]);
    DestroyVehicle(HouseCar[houseid]);
}
if(!HouseInfo[houseid][hOwned]) //Also known as 'if(HouseInfo[houseid][hOwned] == false)' - With aan boolean you can use '!{option}' and "{option}"! (!IsPlayerAdmin())) (IsPlayerAdmin())
{
    //So the house is not owned. Let's make an green mapicon and en green house pickup!
    HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
    HouseInfo[houseid][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
}
else
{
    //House is already owned. Blue pickup and red icon!
    HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
    HouseInfo[houseid][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
}
if(IsValidVehicleModel(HouseInfo[houseid][hVecModel])) //Is the vehicle model valid? In the range of 400-611? Function below
    HouseCar[houseid] = CreateVehicle(HouseInfo[houseid][hVecModel], HouseInfo[houseid][hVecX], HouseInfo[houseid][hVecY], HouseInfo[houseid][hVecZ], HouseInfo[houseid][hVecA], -1, -1, -1); //Color1 -1, Color2 -1, -1 respawn (only respawn with function or on vehicle death)
stock IsValidVehicleModel(vehiclemodel)
{
    if(vehiclemodel >= 400 && vehiclemodel <= 611)
        return true;
    return false;
}
stock SaveHouse(houseid)
{
dini_FloatSet(fstring, "EnterX", HouseInfo[houseid][hEnterX]);
dini_FloatSet(fstring, "EnterY", HouseInfo[houseid][hEnterY]);
dini_FloatSet(fstring, "EnterZ", HouseInfo[houseid][hEnterZ]);
dini_FloatSet(fstring, "ExitX", HouseInfo[houseid][hExitX]);
dini_FloatSet(fstring, "ExitY", HouseInfo[houseid][hExitY]);
dini_FloatSet(fstring, "ExitZ", HouseInfo[houseid][hExitZ]);
dini_IntSet(fstring, "InsideInt", HouseInfo[houseid][hInsideInt]);
dini_IntSet(fstring, "InsideVir", HouseInfo[houseid][hInsideVir]);
dini_IntSet(fstring, "OutsideInt", HouseInfo[houseid][hOutsideInt]);
dini_IntSet(fstring, "OutsideVir", HouseInfo[houseid][hOUtsideVir]);
dini_BoolSet(fstring, "Owned", HouseInfo[houseid][hOwned]);
dini_Get(fstring, "Owner", HouseInfo[houseid][hOwner]); //No, not "GetSet"! :P
dini_IntSet(fstring, "Price", HouseInfo[houseid][hPrice]);
dini_IntSet(fstring, "HV_Model", HouseInfo[houseid][hVecModel]);
dini_FloatSet(fstring, "HV_PosX", HouseInfo[houseid][hVecX]);
dini_FloatSet(fstring, "HV_PosZ", HouseInfo[houseid][hVecY]);
dini_Float(fstring, "HV_PosZ", HouseInfo[houseid][hVecZ]);
dini_Float(fstring, "HV_PosA", HouseInfo[houseid][hVecA]);
}
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    SetTimer("UpdatePlayersHouseInfo", 1000, true); //Every 1000 milli seconds (1 sec.) it will be used again
    return 1;
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 if (strcmp("/mycommand", cmdtext, true, 10) == 0)
 {
        // Do something here
        return 1;
    }
   
 if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
   
     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & 16 && !IsPlayerInAnyVehicle(playerid)) //If player pressed ENTER_VEHICLe and if he's not in an vehicle
    {
        for(new i = 0; i < MAX_HOUSES; i++) //Loop through all the houses
        {
            if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir]) //Is player near house entrance, and if player is in interior of that house + virtual world
            {
                SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
                SetPlayerInterior(playerid, HouseInfo[i][hInsideInt]);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hInsideVir]);
                //This will put the player IN the house
            }
            else if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hInsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hInsideVir]) //Same as the previous IsPlayerInRangeOfPoint, but now if the player is near the house exit+int+vir
            {
                SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
                SetPlayerInterior(playerid, HouseInfo[i][hOutsideInt]);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hOutsideVir]);
            }
        }
    }
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

public UpdatePlayersHouseInfo()
{
    new str[100]; //The string we are gonna format
    for(new i = 0; i < MAX_PLAYERS; i++) //Loop through all the players
    {
        for(new j = 0; j < MAX_HOUSES; j++) //Loop through all the houses
        {
            if(IsPlayerInRangeOfPoint(j, HouseInfo[j][hEnterX], HouseInfo[j][hEnterY], HouseInfo[j][hEnterZ]) && GetPlayerInterior(i) == HouseInfo[j][hOutsideInt] && GetPlayerVirtualWorld(i) == HouseInfo[j][hOutsideVir]) //You already know this! If you don't know it, do step 3 again!
            {
                if(HouseInfo[j][hOwned]) //Is house owned?
                    format(str, 100, "~w~House owned by ~r~%s", HouseInfo[j][hOwner]); //Will give: {white_color}House owned by {yellow_color}OWNER
                else //House isn't owned
                    format(str, 100, "~w~House for sale!~n~Price: ~g~$%d,-", HouseInfo[j][hPrice]); //Will give: {white_color}House for sale!{new line}Price: {green_color}$PRICE
                GameTextForPlayer(i, str, 2000, 3); //Show the text 2 seconds!
            }
         }
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by Mriss
Посмотреть сообщение
I need help with a House System I am making, I am stuck at the "making commands" Part of it, if anyone can help me, heres the script >
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <Dini>

#define MAX_HOUSES 100

#define COLOR_WHITE 0xFFFFFFAA //White color
#define COLOR_RED 0xFF0000AA //Red Color
#define COLOR_GREEN 0x00FF00AA //Green color

forward UpdatePlayersHouseInfo();

enum hInfo
{
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInsideInt,
    hInsideVir,
    hOutsideInt,
    hOutsideVir,
    bool:hOwned,
    hOwner[MAX_PLAYER_NAME],
    hPrice,
    hPickup,
    hIcon,
    hVecModel,
    Float:hVecX,
    Float:hVecY,
    Float:hVecZ,
    Float:hVecA
};

new HouseInfo[MAX_HOUSES][hInfo];
new HouseCar[MAX_HOUSES];

stock LoadHouse(houseid)
{
new fstring[10]; //The string for the file [format]
format(fstring, 10, "Houses/%d", houseid); //Format the filename
if(!dini_Exists(fstring)) return 0;
HouseInfo[houseid][hEnterX] = dini_Float(fstring, "EnterX");
HouseInfo[houseid][hEnterY] = dini_Float(fstring, "EnterY");
HouseInfo[houseid][hEnterZ] = dini_Float(fstring, "EnterZ");
HouseInfo[houseid][hExitX] = dini_Float(fstring, "ExitX");
HouseInfo[houseid][hExitY] = dini_Float(fstring, "ExitY");
HouseInfo[houseid][hExitZ] = dini_Float(fstring, "ExitZ");
HouseInfo[houseid][hInsideInt] = dini_Int(fstring, "InsideInt");
HouseInfo[houseid][hInsideVir] = dini_Int(fstring, "InsideVir");
HouseInfo[houseid][hOutsideInt] = dini_Int(fstring, "OutsideInt");
HouseInfo[houseid][hOUtsideVir] = dini_Int(fstring, "OutsideVir");
HouseInfo[houseid][hOwned] = dini_Bool(fstring, "Owned") ? true : false; //Because it is an boolean: ? true : false;
strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get("Owner"))); //Used this one instead of {string} = {string}. I've ever read that this is faster
HouseInfo[houseid][hPrice] = dini_Int(fstring, "Price");
HouseInfo[houseid][hVecModel] = dini_Int(fstring, "HV_Model");
HouseInfo[houseid][hVecX] = dini_Float(fstring, "HV_PosX");
HouseInfo[houseid][hVecY] = dini_Float(fstring, "HV_PosZ");
HouseInfo[houseid][hVecZ] = dini_Float(fstring, "HV_PosZ");
HouseInfo[houseid][hVecA] = dini_Float(fstring, "HV_PosA");
return 1;
}
stock LoadHouseVisual(houseid, bool:reload = false)
{
if(reload)
{
    DestroyDynamicMapIcon(HouseInfo[houseid][hIcon]);
    DestroyDynamicPickup(HouseInfo[houseid][hPickup]);
    DestroyVehicle(HouseCar[houseid]);
}
if(!HouseInfo[houseid][hOwned]) //Also known as 'if(HouseInfo[houseid][hOwned] == false)' - With aan boolean you can use '!{option}' and "{option}"! (!IsPlayerAdmin())) (IsPlayerAdmin())
{
    //So the house is not owned. Let's make an green mapicon and en green house pickup!
    HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
    HouseInfo[houseid][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
}
else
{
    //House is already owned. Blue pickup and red icon!
    HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
    HouseInfo[houseid][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
}
if(IsValidVehicleModel(HouseInfo[houseid][hVecModel])) //Is the vehicle model valid? In the range of 400-611? Function below
    HouseCar[houseid] = CreateVehicle(HouseInfo[houseid][hVecModel], HouseInfo[houseid][hVecX], HouseInfo[houseid][hVecY], HouseInfo[houseid][hVecZ], HouseInfo[houseid][hVecA], -1, -1, -1); //Color1 -1, Color2 -1, -1 respawn (only respawn with function or on vehicle death)
stock IsValidVehicleModel(vehiclemodel)
{
    if(vehiclemodel >= 400 && vehiclemodel <= 611)
        return true;
    return false;
}
stock SaveHouse(houseid)
{
dini_FloatSet(fstring, "EnterX", HouseInfo[houseid][hEnterX]);
dini_FloatSet(fstring, "EnterY", HouseInfo[houseid][hEnterY]);
dini_FloatSet(fstring, "EnterZ", HouseInfo[houseid][hEnterZ]);
dini_FloatSet(fstring, "ExitX", HouseInfo[houseid][hExitX]);
dini_FloatSet(fstring, "ExitY", HouseInfo[houseid][hExitY]);
dini_FloatSet(fstring, "ExitZ", HouseInfo[houseid][hExitZ]);
dini_IntSet(fstring, "InsideInt", HouseInfo[houseid][hInsideInt]);
dini_IntSet(fstring, "InsideVir", HouseInfo[houseid][hInsideVir]);
dini_IntSet(fstring, "OutsideInt", HouseInfo[houseid][hOutsideInt]);
dini_IntSet(fstring, "OutsideVir", HouseInfo[houseid][hOUtsideVir]);
dini_BoolSet(fstring, "Owned", HouseInfo[houseid][hOwned]);
dini_Get(fstring, "Owner", HouseInfo[houseid][hOwner]); //No, not "GetSet"! :P
dini_IntSet(fstring, "Price", HouseInfo[houseid][hPrice]);
dini_IntSet(fstring, "HV_Model", HouseInfo[houseid][hVecModel]);
dini_FloatSet(fstring, "HV_PosX", HouseInfo[houseid][hVecX]);
dini_FloatSet(fstring, "HV_PosZ", HouseInfo[houseid][hVecY]);
dini_Float(fstring, "HV_PosZ", HouseInfo[houseid][hVecZ]);
dini_Float(fstring, "HV_PosA", HouseInfo[houseid][hVecA]);
}
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    SetTimer("UpdatePlayersHouseInfo", 1000, true); //Every 1000 milli seconds (1 sec.) it will be used again
    return 1;
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 if (strcmp("/mycommand", cmdtext, true, 10) == 0)
 {
        // Do something here
        return 1;
    }
   
 if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
   
     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & 16 && !IsPlayerInAnyVehicle(playerid)) //If player pressed ENTER_VEHICLe and if he's not in an vehicle
    {
        for(new i = 0; i < MAX_HOUSES; i++) //Loop through all the houses
        {
            if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir]) //Is player near house entrance, and if player is in interior of that house + virtual world
            {
                SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
                SetPlayerInterior(playerid, HouseInfo[i][hInsideInt]);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hInsideVir]);
                //This will put the player IN the house
            }
            else if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hInsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hInsideVir]) //Same as the previous IsPlayerInRangeOfPoint, but now if the player is near the house exit+int+vir
            {
                SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
                SetPlayerInterior(playerid, HouseInfo[i][hOutsideInt]);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hOutsideVir]);
            }
        }
    }
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

public UpdatePlayersHouseInfo()
{
    new str[100]; //The string we are gonna format
    for(new i = 0; i < MAX_PLAYERS; i++) //Loop through all the players
    {
        for(new j = 0; j < MAX_HOUSES; j++) //Loop through all the houses
        {
            if(IsPlayerInRangeOfPoint(j, HouseInfo[j][hEnterX], HouseInfo[j][hEnterY], HouseInfo[j][hEnterZ]) && GetPlayerInterior(i) == HouseInfo[j][hOutsideInt] && GetPlayerVirtualWorld(i) == HouseInfo[j][hOutsideVir]) //You already know this! If you don't know it, do step 3 again!
            {
                if(HouseInfo[j][hOwned]) //Is house owned?
                    format(str, 100, "~w~House owned by ~r~%s", HouseInfo[j][hOwner]); //Will give: {white_color}House owned by {yellow_color}OWNER
                else //House isn't owned
                    format(str, 100, "~w~House for sale!~n~Price: ~g~$%d,-", HouseInfo[j][hPrice]); //Will give: {white_color}House for sale!{new line}Price: {green_color}$PRICE
                GameTextForPlayer(i, str, 2000, 3); //Show the text 2 seconds!
            }
         }
    }
    return 1;
}
Man,this aint script request thread.You post here if you find any small problem while scripting.Not asking someone to script something and give it to you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)