Parking Command -
dusk - 18.04.2013
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
Re: Parking Command -
Red_Dragon. - 18.04.2013
What do you mean by command ? I really don't think that this is a command ? Anyway, try to add a variable
Re: Parking Command -
dusk - 18.04.2013
nevermind anything. I went around the problem
Re: Parking Command -
MattyG - 20.04.2013
Why would you use print for this? Wouldn't you use an SCM to tell the player that the the vehicle has an owner?
Re: Parking Command -
dusk - 20.04.2013
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
Re: Parking Command -
SuperViper - 22.04.2013
Have you tried printing the owner of the vehicle to make sure it isn't null?
Re: Parking Command -
dusk - 22.04.2013
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!
Re: Parking Command -
dusk - 24.04.2013
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;
}
Re: Parking Command -
dusk - 25.04.2013
Bump
Re: Parking Command -
dusk - 26.04.2013
bump