/veh park command, not working...
#1

I have the following script to save the x, y, and z co-ordinates of a vehicle that is owned by a player on my server.
Each player has 5 vehicle slots. Stored in files using dini (and dubd for encryption purposes)

Here is the code:
pawn Код:
if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            new file[64], pName[MAX_PLAYER_NAME], vfile[64];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(file, sizeof(file), "vehicle/accounts/%s.veh", pName);
            for(new i; i < 1000; i++)
            {
                if(IsPlayerInVehicle(playerid, PlayerVData[i]) == 1)
                {
                    new Float:vx, Float:vy, Float:vz;
                    GetVehiclePos(GetPlayerVehicleID(playerid), vx, vy, vz);
                    if(dini_Int(file, "1") == PlayerVData[i])
                    {
                        format(vfile, sizeof(vfile), "vehicle/%i", dini_Int(file, "1"));
                        dini_FloatSet(vfile, "x", vx);
                        dini_FloatSet(vfile, "y", vy);
                        dini_FloatSet(vfile, "z", vz);
                        new string[64];
                        format(string, sizeof(string), "Your vehicle (%s) has been parked here!", dini_Get(vfile, "VName"));
                        SendClientMessage(playerid, VEHICLE_COLOUR, string);
                    }
                    else if(dini_Int(file, "2") == PlayerVData[i])
                    {
                        format(vfile, sizeof(vfile), "vehicle/%i", dini_Int(file, "2"));
                        dini_FloatSet(vfile, "x", vx);
                        dini_FloatSet(vfile, "y", vy);
                        dini_FloatSet(vfile, "z", vz);
                        new string[64];
                        format(string, sizeof(string), "Your vehicle (%s) has been parked here!", dini_Get(vfile, "VName"));
                        SendClientMessage(playerid, VEHICLE_COLOUR, string);
                    }
                    else if(dini_Int(file, "3") == PlayerVData[i])
                    {
                        format(vfile, sizeof(vfile), "vehicle/%i", dini_Int(file, "3"));
                        dini_FloatSet(vfile, "x", vx);
                        dini_FloatSet(vfile, "y", vy);
                        dini_FloatSet(vfile, "z", vz);
                        new string[64];
                        format(string, sizeof(string), "Your vehicle (%s) has been parked here!", dini_Get(vfile, "VName"));
                        SendClientMessage(playerid, VEHICLE_COLOUR, string);
                    }
                    else if(dini_Int(file, "4") == PlayerVData[i])
                    {
                        format(vfile, sizeof(vfile), "vehicle/%i", dini_Int(file, "4"));
                        dini_FloatSet(vfile, "x", vx);
                        dini_FloatSet(vfile, "y", vy);
                        dini_FloatSet(vfile, "z", vz);
                        new string[64];
                        format(string, sizeof(string), "Your vehicle (%s) has been parked here!", dini_Get(vfile, "VName"));
                        SendClientMessage(playerid, VEHICLE_COLOUR, string);
                    }
                    else if(dini_Int(file, "5") == PlayerVData[i])
                    {
                        format(vfile, sizeof(vfile), "vehicle/%i", dini_Int(file, "5"));
                        dini_FloatSet(vfile, "x", vx);
                        dini_FloatSet(vfile, "y", vy);
                        dini_FloatSet(vfile, "z", vz);
                        new string[64];
                        format(string, sizeof(string), "Your vehicle (%s) has been parked here!", dini_Get(vfile, "VName"));
                        SendClientMessage(playerid, VEHICLE_COLOUR, string);
                    }
                }
            }
        }
Let me explain a few things...
pawn Код:
PlayerVData
is defined earlier in the script - it has 1000 slots because (if my calculations are correct) the maximum number of purchased vehicles will be 1000.

vfile, is the vehicle file (vehicle/vehicleid.veh) and file is the players file (vehicle/accounts/playername.veh)
vfile holds the vehicle information, and file holds the 5 vehicle id's for that player.

(im using dcmd, so i can have one main command (/veh) and then 'params' is the sub command - in this case 'park')

Scenario
I have the vehicle where i want it - i type /veh park, and if it parked succesfully, it should say
"Your vehicle (Vehicle Name) has been parked here!"
however it doesnt. It doesnt say anything.

It should check GetPlayerVehicleID(playerid) against PlayerVData[i] (looped = i = 0 < 1000) - if it matches it runs another if. If the PlayerVData[i] matches an ID in the players account file, it knows that that specific player owns that vehicle. Then it will right the 'x', 'y' and 'z' co-ordinates to the {vehicleid}.veh file.

Can anyone see a problem / does anyone know a solution?

Thanks
Ash
Reply
#2

-Bump-

This message is too short
Reply
#3

None of your dini_ints are equal to that PlayerVData's.
Reply
#4

Quote:
Originally Posted by RobinOwnz
Посмотреть сообщение
None of your dini_ints are equal to that PlayerVData's.
They are, because if i print the PlayerVData and the dini_Int information, it matches.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)