House System problem [SIMPLE]
#1

Okay,



I was watching a tutorial of how to make a houe system THIS SYSTEM and I dont know why I get this errors, I followed set by step to Kevin, take a look:

ERRORS:
pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(87) : warning 202: number of arguments does not match definition
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(152) : error 017: undefined symbol "A"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(156) : error 017: undefined symbol "A"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(227) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(228) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(229) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(230) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(231) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(232) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(233) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(234) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(235) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(236) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(237) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(238) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(239) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(240) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(241) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(242) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(243) : error 017: undefined symbol "fstring"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(244) : error 017: undefined symbol "fstring"
And this is all my whole code:
pawn Код:
//INCLUDES

#include <a_samp>
#include <Dini>
#include <streamer>

//define system

#define MAX_HOUSES 200
#define COLOR_WHITE 0xFFFFFFAA //White color
#define COLOR_RED 0xFF0000AA //Red Color
#define COLOR_GREEN 0x00FF00AA //Green color
#define COL_ORANGE 0xFF8000FF

//ENUM

enum hInfo
{
    Float:hEnterX, //Entrance X. It's an float! example: 0.0000000. I'm gonna use the same with the other entrances/exits
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hInsideInt, //The inside interior.. DUH!
    hInsideVir, //Already subscribed above
    hOutsideInt,
    hOutsideVir,
    bool:hOwned, //boolean! Is house owned? NO = False, YES = True
    hOwner[MAX_PLAYER_NAME], //The house owner! I'm gonna use MAX_PLAYER_NAME, because a player can't have a longer name :')
    hPrice, //Will store the price
    hPickup, //The pickup. This is used to remove/move the pickup icon!
    hIcon, //The map icon. Also used to remove/move it! We are going to need an ID. Without an ID we can't do NOTHING!
    hVecModel, //The housecar's model
    Float:hVecX, //X location. En float too.
    Float:hVecY,
    Float:hVecZ,
    Float:hVecA
};

//New

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


//Public

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 OnFilterScriptInit()
{
    SetTimer("UpdatePlayersHouseInfo", 1000, true); //Every 1000 milli seconds (1 sec.) it will be used again
    return 1;
}

forward UpdatePlayersHouseInfo();
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;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/buyhouse", true))
    {
        new pName[MAX_PLAYER_NAME]; //For the player's name - For the house
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Get the name of the player and store it in pName
        for(new i = 0; i < MAX_HOUSES; i++) //Last time I'm gonna say it: 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 (Last time I said this too!)
            {
                if(HouseInfo[i][hOwned]) return SendClientMessage(playerid, COLOR_RED, "ERROR: This house is already owned"); //Is the house owned? Then send message that it's owned and stop.
                if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have enough money for this"); //Has player too less money? Send him a message!

                HouseInfo[i][hOwned] = true; //The house is owned, where the player used /buyhouse
                strmid(HouseInfo[i][hOwner], pName, 0, false, strlen(pName)); //Put the players name into the "hOwner" of the house
                GivePlayerMoney(playerid, -HouseInfo[i][hPrice]); //Remove some money of the player.. The value of the house
                SendClientMessage(playerid, COL_ORANGE, "SERVER: You have bought this house"); //Send the player an message.
                SaveHouse(i);
                LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
                return 1;
            }
        }
    }
    if(!strcmp(cmdtext, "/sellhouse", true))
    {
        new pName[MAX_PLAYER_NAME]; //See /buyhouse
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //See new pName[MAX_PLAYER_NAME];
        for(new i = 0; i < MAX_HOUSES; i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir])
            {
                if(!strcmp(HouseInfo[i][hOwner], pName, false)) //Is the owner of the house the same as the players name (is the player the owner?? !)
                {
                    strmid(HouseInfo[i][hOwner], "For Sale", 0, false, 8); //Set the owner of the house to "For Sale"
                    HouseInfo[i][hOwned] = false; //House is not owner anymore!
                    GivePlayerMoney(playerid, HouseInfo[i][hPrice]/2); //Give the player 50% of the house value back!
                    SendClientMessage(playerid, COL_ORANGE, "SERVER: You have sold your house");
                    SaveHouse(i);
                    LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
                    return 1;
                }
             }
        }
    }
    if(!strcmp(cmdtext, "/housecar", true))
    {
        new pName[MAX_PLAYER_NAME], Float:X, Float:Y, Float:Z;
        new houseid = cmdtext[10]; //The param. /tphousecar is 0-8. With a space, 9. Then, the param is at 10.
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        if(!strcmp(HouseInfo[houseid][hOwner], pName, false)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not owned of this house");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be in an vehicle"); //if is player not in an vehicle, send an message and stop (RETURN [message])
        GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
        GetVehicleZAngle(GetPlayerVehicleID(playerid), A);
        HouseInfo[houseid][hVecX] = X;
        HouseInfo[houseid][hVecY] = Y;
        HouseInfo[houseid][hVecZ] = Z;
        HouseInfo[houseid][hVecA] = A;
        return 1;
    }
    return 1;
}

//==============================================================================

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; //"If Houses/{houseid} not exists then return False (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]);
}
I changed the stock sites to check if the errors get solved but not, still being the same

If anyone can help me

Regards,
Pablo.
Reply
#2

Can you put your code in [pawn ]CODE[/pawn ] please?
Reply
#3

Also, between what and what are you getting the error? You probably forgot
pawn Код:
new fstring[100];
somewhere
Reply
#4

Thanks , but now I get this errors:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(88) : warning 202: number of arguments does not match definition
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(153) : error 017: undefined symbol "A"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(157) : error 017: undefined symbol "A"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(237) : error 017: undefined symbol "hOUtsideVir"
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(239) : warning 202: number of arguments does not match definition
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(244) : warning 202: number of arguments does not match definition
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(245) : warning 202: number of arguments does not match definition
LINES:
pawn Код:
HouseInfo[houseid][hVecA] = A;

GetVehicleZAngle(GetPlayerVehicleID(playerid), A);

dini_IntSet(fstring, "OutsideVir", HouseInfo[houseid][hOUtsideVir]);
Reply
#5

Use
pawn Код:
new A = GetPlayerVehicleID(playerid);
Reply
#6

EDIT: I fixed that problem, but now I get this error
pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\HOUSES.pwn(240) : error 017: undefined symbol "hOUtsideVir"
How can I fix it if the code is this:
pawn Код:
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]); //THIS LINE!
    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]);
}
Reply
#7

Change it to hOutsideVir (find and replace, it happend because of wrong big letters and small letters according to your enum hinfo
Reply
#8

Oh, I`m stupid! thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)