Need a little help about parkcar code. -
EkaFist - 29.10.2015
PHP код:
if(strcmp(cmd, "/parkvehicle", true) == 0 || strcmp(cmd, "/pv", true) == 0) // Parking the car.
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2)
{
GetPlayerVehicleMods(playerid);
if(PlayerVehicleID1[playerid] == vehicleid)
{
GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX1], PlayerInfo[playerid][PlayerVehiclePosY1], PlayerInfo[playerid][PlayerVehiclePosZ1]);
GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing1]);
DestroyVehicle(PlayerVehicleID1[playerid]);
PlayerInfo[playerid][PlayerVehicle1VirWorld] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][PlayerVehicle1Interior] = GetPlayerInterior(playerid);
CreatePlayerVehicle(playerid,1);
PutPlayerInVehicle(playerid,PlayerVehicleID1[playerid],0);
}
else if(PlayerVehicleID2[playerid] == vehicleid)
{
GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX2], PlayerInfo[playerid][PlayerVehiclePosY2], PlayerInfo[playerid][PlayerVehiclePosZ2]);
GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing2]);
DestroyVehicle(PlayerVehicleID2[playerid]);
PlayerInfo[playerid][PlayerVehicle2VirWorld] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][PlayerVehicle2Interior] = GetPlayerInterior(playerid);
CreatePlayerVehicle(playerid,2);
PutPlayerInVehicle(playerid,PlayerVehicleID2[playerid],0);
}
else if(PlayerVehicleID3[playerid] == vehicleid)
{
GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX3], PlayerInfo[playerid][PlayerVehiclePosY3], PlayerInfo[playerid][PlayerVehiclePosZ3]);
GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing3]);
DestroyVehicle(PlayerVehicleID3[playerid]);
PlayerInfo[playerid][PlayerVehicle3VirWorld] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][PlayerVehicle3Interior] = GetPlayerInterior(playerid);
CreatePlayerVehicle(playerid,3);
PutPlayerInVehicle(playerid,PlayerVehicleID3[playerid],0);
}
else if(PlayerVehicleID4[playerid] == vehicleid)
{
GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX4], PlayerInfo[playerid][PlayerVehiclePosY4], PlayerInfo[playerid][PlayerVehiclePosZ4]);
GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing4]);
DestroyVehicle(PlayerVehicleID4[playerid]);
PlayerInfo[playerid][PlayerVehicle4VirWorld] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][PlayerVehicle4Interior] = GetPlayerInterior(playerid);
CreatePlayerVehicle(playerid,4);
PutPlayerInVehicle(playerid,PlayerVehicleID4[playerid],0);
}
else if(PlayerVehicleID5[playerid] == vehicleid)
{
GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX5], PlayerInfo[playerid][PlayerVehiclePosY5], PlayerInfo[playerid][PlayerVehiclePosZ5]);
GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing5]);
DestroyVehicle(PlayerVehicleID5[playerid]);
PlayerInfo[playerid][PlayerVehicle5VirWorld] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][PlayerVehicle5Interior] = GetPlayerInterior(playerid);
CreatePlayerVehicle(playerid,5);
PutPlayerInVehicle(playerid,PlayerVehicleID5[playerid],0);
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not in a vehicle that you own.");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not driving a vehicle.");
}
}
return 1;
}
My problem is , when i use the command, it parks the car in the place but changes the colors/modifications.
can somebody help me?
Re: Need a little help about parkcar code. -
EkaFist - 29.10.2015
Anyone ?
Re: Need a little help about parkcar code. -
gurmani11 - 29.10.2015
PHP код:
GetPlayerVehicleMods(playerid);
show this function
Re: Need a little help about parkcar code. -
EkaFist - 02.11.2015
Quote:
Originally Posted by gurmani11
PHP код:
GetPlayerVehicleMods(playerid);
show this function
|
PHP код:
public GetPlayerVehicleMods(playerid)
{
// Vehicle 1
PlayerInfo[playerid][PlayerVehicle1ModSlot0] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 0);
PlayerInfo[playerid][PlayerVehicle1ModSlot1] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 1);
PlayerInfo[playerid][PlayerVehicle1ModSlot2] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 2);
PlayerInfo[playerid][PlayerVehicle1ModSlot3] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 3);
PlayerInfo[playerid][PlayerVehicle1ModSlot4] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 4);
PlayerInfo[playerid][PlayerVehicle1ModSlot5] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 5);
PlayerInfo[playerid][PlayerVehicle1ModSlot6] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 6);
PlayerInfo[playerid][PlayerVehicle1ModSlot7] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 7);
PlayerInfo[playerid][PlayerVehicle1ModSlot8] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 8);
PlayerInfo[playerid][PlayerVehicle1ModSlot9] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 9);
PlayerInfo[playerid][PlayerVehicle1ModSlot10] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 10);
PlayerInfo[playerid][PlayerVehicle1ModSlot11] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 11);
PlayerInfo[playerid][PlayerVehicle1ModSlot12] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 12);
PlayerInfo[playerid][PlayerVehicle1ModSlot13] = GetVehicleComponentInSlot(PlayerVehicleID1[playerid], 13);
// Vehicle 2
PlayerInfo[playerid][PlayerVehicle2ModSlot0] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 0);
PlayerInfo[playerid][PlayerVehicle2ModSlot1] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 1);
PlayerInfo[playerid][PlayerVehicle2ModSlot2] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 2);
PlayerInfo[playerid][PlayerVehicle2ModSlot3] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 3);
PlayerInfo[playerid][PlayerVehicle2ModSlot4] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 4);
PlayerInfo[playerid][PlayerVehicle2ModSlot5] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 5);
PlayerInfo[playerid][PlayerVehicle2ModSlot6] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 6);
PlayerInfo[playerid][PlayerVehicle2ModSlot7] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 7);
PlayerInfo[playerid][PlayerVehicle2ModSlot8] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 8);
PlayerInfo[playerid][PlayerVehicle2ModSlot9] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 9);
PlayerInfo[playerid][PlayerVehicle2ModSlot10] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 10);
PlayerInfo[playerid][PlayerVehicle2ModSlot11] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 11);
PlayerInfo[playerid][PlayerVehicle2ModSlot12] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 12);
PlayerInfo[playerid][PlayerVehicle2ModSlot13] = GetVehicleComponentInSlot(PlayerVehicleID2[playerid], 13);
// Vehicle 3
PlayerInfo[playerid][PlayerVehicle3ModSlot0] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 0);
PlayerInfo[playerid][PlayerVehicle3ModSlot1] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 1);
PlayerInfo[playerid][PlayerVehicle3ModSlot2] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 2);
PlayerInfo[playerid][PlayerVehicle3ModSlot3] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 3);
PlayerInfo[playerid][PlayerVehicle3ModSlot4] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 4);
PlayerInfo[playerid][PlayerVehicle3ModSlot5] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 5);
PlayerInfo[playerid][PlayerVehicle3ModSlot6] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 6);
PlayerInfo[playerid][PlayerVehicle3ModSlot7] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 7);
PlayerInfo[playerid][PlayerVehicle3ModSlot8] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 8);
PlayerInfo[playerid][PlayerVehicle3ModSlot9] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 9);
PlayerInfo[playerid][PlayerVehicle3ModSlot10] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 10);
PlayerInfo[playerid][PlayerVehicle3ModSlot11] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 11);
PlayerInfo[playerid][PlayerVehicle3ModSlot12] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 12);
PlayerInfo[playerid][PlayerVehicle3ModSlot13] = GetVehicleComponentInSlot(PlayerVehicleID3[playerid], 13);
// Vehicle 4
PlayerInfo[playerid][PlayerVehicle4ModSlot0] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 0);
PlayerInfo[playerid][PlayerVehicle4ModSlot1] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 1);
PlayerInfo[playerid][PlayerVehicle4ModSlot2] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 2);
PlayerInfo[playerid][PlayerVehicle4ModSlot3] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 3);
PlayerInfo[playerid][PlayerVehicle4ModSlot4] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 4);
PlayerInfo[playerid][PlayerVehicle4ModSlot5] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 5);
PlayerInfo[playerid][PlayerVehicle4ModSlot6] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 6);
PlayerInfo[playerid][PlayerVehicle4ModSlot7] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 7);
PlayerInfo[playerid][PlayerVehicle4ModSlot8] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 8);
PlayerInfo[playerid][PlayerVehicle4ModSlot9] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 9);
PlayerInfo[playerid][PlayerVehicle4ModSlot10] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 10);
PlayerInfo[playerid][PlayerVehicle4ModSlot11] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 11);
PlayerInfo[playerid][PlayerVehicle4ModSlot12] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 12);
PlayerInfo[playerid][PlayerVehicle4ModSlot13] = GetVehicleComponentInSlot(PlayerVehicleID4[playerid], 13);
// Vehicle 5
PlayerInfo[playerid][PlayerVehicle5ModSlot0] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 0);
PlayerInfo[playerid][PlayerVehicle5ModSlot1] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 1);
PlayerInfo[playerid][PlayerVehicle5ModSlot2] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 2);
PlayerInfo[playerid][PlayerVehicle5ModSlot3] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 3);
PlayerInfo[playerid][PlayerVehicle5ModSlot4] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 4);
PlayerInfo[playerid][PlayerVehicle5ModSlot5] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 5);
PlayerInfo[playerid][PlayerVehicle5ModSlot6] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 6);
PlayerInfo[playerid][PlayerVehicle5ModSlot7] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 7);
PlayerInfo[playerid][PlayerVehicle5ModSlot8] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 8);
PlayerInfo[playerid][PlayerVehicle5ModSlot9] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 9);
PlayerInfo[playerid][PlayerVehicle5ModSlot10] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 10);
PlayerInfo[playerid][PlayerVehicle5ModSlot11] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 11);
PlayerInfo[playerid][PlayerVehicle5ModSlot12] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 12);
PlayerInfo[playerid][PlayerVehicle5ModSlot13] = GetVehicleComponentInSlot(PlayerVehicleID5[playerid], 13);
return 1;
}
Here you go sir ..
Re: Need a little help about parkcar code. -
EkaFist - 02.11.2015
Anyone?
Re: Need a little help about parkcar code. -
EkaFist - 02.11.2015
Guys?
Re: Need a little help about parkcar code. -
PrO.GameR - 02.11.2015
Your CMD doesn't make any sense, you are creating a
new vehicle ( can't stress enough, NEW )
how would the game know you are simply remaking the same car unless you tell it ?
Get vehicle color - components before destroying it, re-install all after re-creating the vehicle (
https://sampwiki.blast.hk/wiki/AddVehicleComponent -
https://sampwiki.blast.hk/wiki/ChangeVehicleColor )