[POMOC] Map marker, parkiranje, zakljucavanje

Započeo 032.Marcus, Maj 17, 2014, 15:30:00 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Pre svega, samo da kazem da PlayerInfo[playerid][pVehicle1] tj uopste pVehicle je isti kao ID igracevog vozila...

Scripta: moja od nule
Problem: kada kucam komandu da mi pronadje vozilo na mapi, uvek mi oznaci gore u nekom selu (kao kada pronalazite igraca a on u kuci), i tako za svako vozilo
Code:
YCMD:find(playerid, params[], help)
{
#pragma unused help
new slot, vehicle, Float:VX, Float:VY, Float:VZ;
if(sscanf(params, "i", slot)) return SCM(playerid, -1, ""PLAVA"KORISCENJE"BELA": /find [slot]");
switch(slot)
{
    case 1:
    {
    if(PlayerInfo[playerid][pVehicle1] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na prvom slotu!");
    vehicle = PlayerInfo[playerid][pVehicle1];
    GetVehiclePos(vehicle, VX, VY, VZ);
    SetPlayerCheckpoint(playerid, VX, VY, VZ, 5.0);
    SCM(playerid, -1, ""NARANDZASTA"Vase vozilo je oznaceno na mapi!");
    }
    case 2:
    {
    if(PlayerInfo[playerid][pVehicle2] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na drugom slotu!");
    vehicle = PlayerInfo[playerid][pVehicle2];
    GetVehiclePos(vehicle, VX, VY, VZ);
    SetPlayerCheckpoint(playerid, VX, VY, VZ, 5.0);
    SCM(playerid, -1, ""NARANDZASTA"Vase vozilo je oznaceno na mapi!");
    }
    case 3:
    {
    if(PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na trecem slotu!");
    vehicle = PlayerInfo[playerid][pVehicle3];
    GetVehiclePos(vehicle, VX, VY, VZ);
    SetPlayerCheckpoint(playerid, VX, VY, VZ, 5.0);
    SCM(playerid, -1, ""NARANDZASTA"Vase vozilo je oznaceno na mapi!");
    }
}
return 1;
}


Problem: kada parkiram vozilo, uvek ga iskosi, a ne parkira onako kako stoji kada ukucam komandu... uvek na istu stranu ga zaokrene bez obzira kako se parkiram
code:
YCMD:park(playerid, params[], help)
{
#pragma unused help
new sendername[32], slot, vID, vMDL, Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, sendername, sizeof(sendername));
vID = GetPlayerVehicleID(playerid);
vMDL = GetVehicleModel(vID);
if(sscanf(params, "i", slot)) return SCM(playerid, -1, ""NARANDZASTA"KORISCENJE: /park [slot]");
if(PlayerInfo[playerid][pVehicle1] == 999 && PlayerInfo[playerid][pVehicle2] == 999 && PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo.");
switch(slot)
{
case 1:
{
    if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""NARANDZASTA"Niste u vozilu.");
    if(PlayerInfo[playerid][pVehicle1] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na prvom slotu.");
    if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle1ControlID]) return SCM(playerid, -1, ""NARANDZASTA"Niste u vasem vozilu.");
    GetVehiclePos(vID, X, Y, Z);
    VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
            SetVehicleComponents(vID);
TogglePlayerControllable(playerid, 1);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
SaveVehicle(vID);
}
case 2:
{
    if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""NARANDZASTA"Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle2] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na drugom slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle2ControlID]) return SCM(playerid, -1, ""NARANDZASTA"Niste u vasem vozilu.");
    GetVehiclePos(vID, X, Y, Z);
    VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
TogglePlayerControllable(playerid, 1);
SetVehicleComponents(vID);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
SaveVehicle(vID);
}
case 3:
{
    if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""NARANDZASTA"Niste u vozilu.");
    if(PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na trecem slotu.");
    if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle3ControlID]) return SCM(playerid, -1, ""NARANDZASTA"Niste u vasem vozilu.");
    GetVehiclePos(vID, X, Y, Z);
    VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
TogglePlayerControllable(playerid, 1);
SetVehicleComponents(vID);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
SaveVehicle(vID);
}
}
return 1;
}


Problem: Kada zelim da zakljucam vozilo, uvek pise da nisam blizu vozila...
code:
YCMD:lock(playerid, params[], help)
{
#pragma unused help
new engine, lights, alarm, doors, bonnet, boot, objective;
new slot, Float:VX, Float:VY, Float:VZ;

if(sscanf(params, "i", slot)) return SCM(playerid, -1, ""PLAVA"KORISCENJE"BELA": /lock [slot]");
switch(slot)
{
    case 1:
    {
        if(PlayerInfo[playerid][pVehicle1] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na prvom slotu!");
        new vehicle = PlayerInfo[playerid][pVehicle1];
GetVehiclePos(vehicle, VX, VY, VZ);
if(IsPlayerInRangeOfPoint(playerid, 50.0, VX, VY, VZ))
    {
    GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    if(doors == 1)
    {
  GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicle,engine,lights,alarm,false,bonnet,boot,objective);
    GameTextForPlayer(playerid,"Vehicle Unlocked!",2000,6);
    VehicleInfo[vehicle][vLocked] = 0;
    SaveVehicle(vehicle);
    return 1;
    }
    else
    {
    SetVehicleParamsEx(vehicle,engine,lights,alarm,true,bonnet,boot,objective);
        GameTextForPlayer(playerid,"Vehicle Locked!",2000,6);
        VehicleInfo[vehicle][vLocked] = 0;
        SaveVehicle(vehicle);
    }
}
else return SCM(playerid, -1, ""NARANDZASTA"Niste blizu svog vozila!");
}
case 2:
    {
        if(PlayerInfo[playerid][pVehicle2] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na drugom slotu!");
        new vehicle = PlayerInfo[playerid][pVehicle2];
GetVehiclePos(vehicle, VX, VY, VZ);
  if(IsPlayerInRangeOfPoint(playerid, 50.0, VX, VY, VZ))
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    if(doors == 1)
    {
  GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicle,engine,lights,alarm,false,bonnet,boot,objective);
    GameTextForPlayer(playerid,"Vehicle Unlocked!",2000,6);
    VehicleInfo[vehicle][vLocked] = 0;
    SaveVehicle(vehicle);
    return 1;
    }
    else
    {
    SetVehicleParamsEx(vehicle,engine,lights,alarm,true,bonnet,boot,objective);
        GameTextForPlayer(playerid,"Vehicle Locked!",2000,6);
        VehicleInfo[vehicle][vLocked] = 0;
        SaveVehicle(vehicle);
    }
    }
    else return SCM(playerid, -1, ""NARANDZASTA"Niste blizu svog vozila!");
}
case 3:
    {
        if(PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""NARANDZASTA"Nemate vozilo na trecem slotu!");
        new vehicle = PlayerInfo[playerid][pVehicle3];
GetVehiclePos(vehicle, VX, VY, VZ);
  if(IsPlayerInRangeOfPoint(playerid, 50.0, VX, VY, VZ))
  {
    GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    if(doors == 1)
    {
  GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicle,engine,lights,alarm,false,bonnet,boot,objective);
    GameTextForPlayer(playerid,"Vehicle Unlocked!",2000,6);
    VehicleInfo[vehicle][vLocked] = 0;
                SaveVehicle(vehicle);
    return 1;
    }
    else
    {
    SetVehicleParamsEx(vehicle,engine,lights,alarm,true,bonnet,boot,objective);
        GameTextForPlayer(playerid,"Vehicle Locked!",2000,6);
        VehicleInfo[vehicle][vLocked] = 0;
        SaveVehicle(vehicle);
    }
}
else return SCM(playerid, -1, ""NARANDZASTA"Niste blizu svog vozila!");
}
}
return 1;
}



EDIT: Problem za parkiranje sredjen.
Poslednja Izmena: Maj 17, 2014, 18:58:46 POSLE PODNE od 032.Marcus

Izvinjavam se za double post, ali evo slike za komandu find...
Postavi checkpoint, i u njega stavi gomilu 3dtextlabel za kuce/biznise (a ni 1 kuca ni biznis nije napravljen trenutno)... A ni kola se ne nalaze ovde, vec uvek ovde postavi Checkpoint
Poslednja Izmena: Maj 17, 2014, 20:21:09 POSLE PODNE od 032.Marcus