Little help over here please
#1

Hi everyone,

I had a busy day today, so maybe the answer to this question is very simple, but i just don't get it.

I need to get the name, in this case, the number of a file, that is with the garage the player enters.

For example, I go to a random garage, and I /enter it, then i want the name of the file the garage is loaded from.

Does anyone know this?
((Sry for the nooby question, but i'm a bit tired, but i have to finish this ))
Reply
#2

We can't help you without any code or anything. Please show your code for your saving system/garage system. Then maybe I can help you out.
Reply
#3

Quote:
Originally Posted by iGetty
Посмотреть сообщение
We can't help you without any code or anything. Please show your code for your saving system/garage system. Then maybe I can help you out.
thanks
here is the saving system:
pawn Код:
forward SaveGarages();
public SaveGarages()
{
    new counter = 0;
    for(new i = 0;i < MAX_GARAGES ;++i)
    {
        format(string,256,base,counter);
        if(fexist(string))
        {
            fremove(string);
        }
    }
    for(new i = 0;i < MAX_GARAGES ;++i)
    {
        format(string,256,base,counter);

        if(GI[i][I] != -1)
        {
           
            INI_Open(string);
            INI_WriteString("O", GI[i][O]);
            INI_WriteFloat("X", GI[i][X]);
            INI_WriteFloat("Y", GI[i][Y]);
            INI_WriteFloat("Z", GI[i][Z]);
            INI_WriteInt("P", GI[i][P]);
            INI_WriteInt("E", GI[i][E]);
            INI_WriteInt("VW", GI[i][vw]);
            if(GI[i][L] == true)
            {
                INI_WriteInt("L", 1);
            }
            else
            {
                INI_WriteInt("L", 0);
            }
            ++counter;
            INI_Save();
            INI_Close();
        }
    }
    return 1;
}
BTW, if you can help me, I would like to load the virtualworld from the file, here it is VW, and i want to store it into a PVar..
Reply
#4

Have you got a /enter command already set-up?

If so, please post it here.

Thanks.
Reply
#5

pawn Код:
CMD:gent(playerid,params[])
{
    if(GotIn[playerid] == -1)
    {
        new i = LastPickup[playerid];
        if(GI[i][I] == -1)return 1;

        if(IsPlayerInRangeOfPoint(playerid, 7.0, GI[i][X], GI[i][Y], GI[i][Z]))
        {
            if(strlen(GI[i][O]) < 3)
            {
                PutPlayerInGarage(playerid,i);
            }
            else
            {
                new name[32];
                GetPlayerName(playerid,name,32);
                if(!strcmp(name,GI[i][O],true))
                {
                    PutPlayerInGarage(playerid,i);

                }
                else
                {
                    if(GI[i][L] == true)
                    {
                        SendClientMessage(playerid,-1,"This garage is from someone else and is locked!!");
                    }
                    else
                    {
                        PutPlayerInGarage(playerid,i);
                       
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid,-1,"Get on a garage pickup!");
        }
    }
    else
    {
        PullOutOfGarage(playerid);
    }
    return 1;
}
Thanks for taking time to help
Reply
#6

Not a problem mate, but the thing that you want is what? The ID of the garage that you are entering?

If so, let me know!
Reply
#7

Yeah well, I actually want that if someone /enter s the garage, that it gets the integer stored in the file under VW((virtual world)) and set it into a PVar
((ill be back soon, i'm eating my dinner ))
Reply
#8

Well, to get the ID of the garage, copy this command and read the comments that I have added.

pawn Код:
CMD:gent(playerid,params[])
{
    if(GotIn[playerid] == -1)
    {
        new i = LastPickup[playerid];
        if(GI[i][I] == -1)return 1;
        if(IsPlayerInRangeOfPoint(playerid, 7.0, GI[i][X], GI[i][Y], GI[i][Z]))
        {
            if(strlen(GI[i][O]) < 3)
            {
                PutPlayerInGarage(playerid,i);
            }
            else
            {
                new name[32];
                GetPlayerName(playerid,name,32);
                if(!strcmp(name,GI[i][O],true))
                {
                    PutPlayerInGarage(playerid,i);
                }
                else
                {
                    if(GI[i][L] == true)
                    {
                        SendClientMessage(playerid,-1,"This garage is from someone else and is locked!!");
                    }
                    else
                    {
                        PutPlayerInGarage(playerid,i);
                        new string[52];
                        format(string, sizeof(string), "The garage ID is: %d\nThe Virtual World is: %d", i, GI[i][vw]);
                        SendClientMessage(playerid, 0xFFFFFFF, string);//The bits that are here are the ones that are going to tell you the garage ID and the Virtual World.
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid,-1,"Get on a garage pickup!");
        }
    }
    else
    {
        PullOutOfGarage(playerid);
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by iGetty
Посмотреть сообщение
Well, to get the ID of the garage, copy this command and read the comments that I have added.

pawn Код:
CMD:gent(playerid,params[])
{
    if(GotIn[playerid] == -1)
    {
        new i = LastPickup[playerid];
        if(GI[i][I] == -1)return 1;
        if(IsPlayerInRangeOfPoint(playerid, 7.0, GI[i][X], GI[i][Y], GI[i][Z]))
        {
            if(strlen(GI[i][O]) < 3)
            {
                PutPlayerInGarage(playerid,i);
            }
            else
            {
                new name[32];
                GetPlayerName(playerid,name,32);
                if(!strcmp(name,GI[i][O],true))
                {
                    PutPlayerInGarage(playerid,i);
                }
                else
                {
                    if(GI[i][L] == true)
                    {
                        SendClientMessage(playerid,-1,"This garage is from someone else and is locked!!");
                    }
                    else
                    {
                        PutPlayerInGarage(playerid,i);
                        new string[52];
                        format(string, sizeof(string), "The garage ID is: %d\nThe Virtual World is: %d", i, GI[i][vw]);
                        SendClientMessage(playerid, 0xFFFFFFF, string);//The bits that are here are the ones that are going to tell you the garage ID and the Virtual World.
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid,-1,"Get on a garage pickup!");
        }
    }
    else
    {
        PullOutOfGarage(playerid);
    }
    return 1;
}
Man!? thanks, it works!
Reply
#10

That's fine!, now all you need to do is create a variable for your virtual world; then save it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)