/lockfcar issue - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /lockfcar issue (
/showthread.php?tid=431505)
/lockfcar issue -
Stanford - 18.04.2013
So when I just ride the car in it's position I can do /lockfcar when its on its position [where I created it], but when I just walk away from the position I wont be able to do /lockfcar it says that Im not near a familycar
Here's the code:
pawn Код:
}
if(strcmp(cmd, "/lockfcar", true) == 0)
{
new sendername2[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, sendername2,MAX_PLAYER_NAME);
for(new fv=0;fv<MAX_FAMVEHICLES;fv++)
{
if(fVehicleInfo[fv][fvID] != 0 &&IsPlayerInRangeOfPoint(playerid, 5.0, fVehicleInfo[fv][fvX], fVehicleInfo[fv][fvY], fVehicleInfo[fv][fvZ]))
{
if(PlayerInfo[playerid][pFMember] == fVehicleInfo[fv][fvFam])
{
if(fVehicleInfo[fv][fvLocked] != 0)
{
fVehicleInfo[fv][fvLocked] = 0;
UnLockCar(fVehicleInfo[fv][fvID]);
format(string, sizeof(string), "* %s has unlocked the family car.", sendername2);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
if(fVehicleInfo[fv][fvLocked] == 0)
{
fVehicleInfo[fv][fvLocked] = 1;
LockCar(fVehicleInfo[fv][fvID]);
format(string, sizeof(string), "* %s has locked the family car.", sendername2);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You're not in the family that owns this car !");
}
}
else
{
if(fv != MAX_FAMVEHICLES-1)
{
continue;
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You're not near to any family car !");
}
}
}
return 1;
}
Re: /lockfcar issue -
Necip - 18.04.2013
Try:
pawn Код:
if(strcmp(cmd, "/lockfcar", true) == 0)
{
new sendername2[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, sendername2,MAX_PLAYER_NAME);
for(new fv=0;fv<MAX_FAMVEHICLES;fv++)
{
if(fVehicleInfo[fv][fvID] != 0 &&IsPlayerInRangeOfPoint(playerid, 5.0, fVehicleInfo[fv][fvX], fVehicleInfo[fv][fvY], fVehicleInfo[fv][fvZ]))
{
if(PlayerInfo[playerid][pFMember] == fVehicleInfo[fv][fvFam])
{
if(fVehicleInfo[fv][fvLocked] != 0)
{
fVehicleInfo[fv][fvLocked] = 0;
UnLockCar(fVehicleInfo[fv][fvID]);
format(string, sizeof(string), "* %s has unlocked the family car.", sendername2);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
if(fVehicleInfo[fv][fvLocked] == 0)
{
fVehicleInfo[fv][fvLocked] = 1;
LockCar(fVehicleInfo[fv][fvID]);
format(string, sizeof(string), "* %s has locked the family car.", sendername2);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You're not in the family that owns this car !");
}
}
else
{
if(fv != MAX_FAMVEHICLES-1)
{
continue;
}
return SendClientMessage(playerid, COLOR_GREY," You're not near to any family car !");
}
}
return 1;
Re: /lockfcar issue -
Stanford - 18.04.2013
didnt work, any other help?
Re: /lockfcar issue -
Stanford - 18.04.2013
also, when I just go to the position that I did /createfcar in it, I can lock and unlock the car even if the car isnt there..
Re: /lockfcar issue -
Pottus - 18.04.2013
That is some really ugly scripting, you need to work on your logic and program flow.
Re: /lockfcar issue -
BigGroter - 18.04.2013
You have to get the car's current position.
Re: /lockfcar issue -
Stanford - 19.04.2013
Any help? I mean how do I do that?
Re: /lockfcar issue -
Stanford - 19.04.2013
How do I do it?
Re: /lockfcar issue -
dr.lozer - 19.04.2013
Don't double post.
Your codes are little ugly.
Re: /lockfcar issue -
Stanford - 19.04.2013
How to fix it? should I re-write it? how?