Parking Command
#1

pawn Код:
GetPlayerName(playerid,Name,sizeof(Name));
        if(!isnull(VehicleInfo[GetPlayerVehicleID(playerid)][owner]) && !strcmp(VehicleInfo[GetPlayerVehicleID(playerid)][owner],Name))
        {
            DestroyVehicle(GetPlayerVehicleID(playerid));
        }
Thats my parking command, there's no errors while compiling,but i doesn't work.
I added prints to the part it loads the name, it prints the name alright..But just doesn't destroy the vehicle
Reply
#2

What do you mean by command ? I really don't think that this is a command ? Anyway, try to add a variable
Reply
#3

nevermind anything. I went around the problem
Reply
#4

Why would you use print for this? Wouldn't you use an SCM to tell the player that the the vehicle has an owner?
Reply
#5

SCM? What is that? Tell me more!
I used print because i see no problem why it shouldn't work and because it just doesn't
Reply
#6

Have you tried printing the owner of the vehicle to make sure it isn't null?
Reply
#7

Well i printed it when i load it from my DB,and yes it's not null,its correct.

And when i try to park it, then the owner is null..

And thanks a lot for trying!
Reply
#8

Okay, i still need help with that above^^.

But I tired another way:
pawn Код:
VehicleID = CreateVehicle(VehicleInfo[VehicleID][Model],VehicleInfo[VehicleID][X],VehicleInfo[VehicleID][Y],VehicleInfo[VehicleID][Z],VehicleInfo[VehicleID][R],VehicleInfo[VehicleID][CColor1],VehicleInfo[VehicleID][CColor2],-1);
VehicleID is just some variable. Then the createvehicle returns the id of the new vehicle right?

I assign that VehicleID to a player. That works well, no problems there. Then i try to park it:
pawn Код:
printf("Savininkas as");
            new pveh;
            pveh = GetPlayerPrivateVehicleID(playerid);
            printf("%d",pveh);
            if(IsPlayerInRangeOfPoint(playerid,10,VehicleInfo[pveh][X],VehicleInfo[pveh][Y],VehicleInfo[pveh][Z]))
            {
                printf("As esu vietoje");
                DestroyVehicle(pveh);
                if(pveh==PlayerInfo[playerid][Vehicle]) PlayerInfo[playerid][Vehicle]=-1;
                else if(pveh==PlayerInfo[playerid][Vehicle2]) PlayerInfo[playerid][Vehicle2]=-1;
                SaveStats(playerid);
            }
And here's is the weird part. I have another command which tells me the vehicle IDs assigned to me and my current vehicle id. And they are the same! And yet it doesn't destroy the vehicle. I hope i was clear.

The short version of it: even tho, the ID assign to me is the same as my current veh, it doesn't destroy it.

P.S. the GetPlayerPrivateVehicleID function:
pawn Код:
stock GetPlayerPrivateVehicleID(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerVehicleID(playerid)==PlayerInfo[playerid][Vehicle]) return PlayerInfo[playerid][Vehicle];
        else if(GetPlayerVehicleID(playerid)==PlayerInfo[playerid][Vehicle2]) return PlayerInfo[playerid][Vehicle2];
        else return 0;
    }
    else return 0;
}
Reply
#9

Bump
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)