[Help] /lock
#1

Hello.

I have a problem with this command..

the problem is that it locks every car even if you dont own it. and its locking only if you're in the car and not in the Distance 5 of it.

Код:
if(strcmp(cmd, "/lock", true) == 0)
		{new plyName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
		if(strcmp(VehicleSystem[GetCreatorID(vehicleid)][owner],plyName,true) == 0)
		{
		new dist = CheckPlayerDistanceToVehicle(5, playerid, vehicleid);
		if(dist)
		{
		PlayerActionMessage(playerid,15.0,"locks the vehicle.");
 		}
		else
		{
 		SendClientMessage(playerid,COLOR_GREY,"You're not near your vehicle!");
 		}}
		else
		{
 		SendClientMessage(playerid,COLOR_GREY,"This is not your vehicle.");
 		}
		return 1;
		}
Reply
#2

I am looking for something similar.

But I want to be able to use a similar lock to yours up there ^ but I can only do that after I enter the car once.
Reply
#3

Can anyone help with it ?
Reply
#4

Ok i got this command now..

its working fine but only if i am in a car and not with distance..

Код:
	if(strcmp(cmd, "/lock", true) == 0)
		{
		//new dist = CheckPlayerDistanceToVehicle(5, playerid, vehicleid);
		new Float:vx,Float:vy,Float:vz;
		GetVehiclePos(GetCreatorID(playerid),vx,vy,vz);
		if(GetCreatorID(vehicleid)!=0)
		{
		if(strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid)) || PlayerToPoint(5, playerid,vx,vy,vz))
		{
		PlayerActionMessage(playerid,15.0,"locks the vehicle.");
		VehicleSystem[GetCreatorID(vehicleid)][locked] = 1;
		SaveTool();
 		}
		else
		{
 		}}
		else
		{
 		SendClientMessage(playerid,COLOR_GREY,"You're not near your vehicle!");
 		}
		return 1;
		}
Reply
#5

Quote:
Originally Posted by [Sk
Noob ]
Ok i got this command now..

its working fine but only if i am in a car and not with distance..

Код:
	if(strcmp(cmd, "/lock", true) == 0)
		{
		//new dist = CheckPlayerDistanceToVehicle(5, playerid, vehicleid);
		new Float:vx,Float:vy,Float:vz;
		GetVehiclePos(GetCreatorID(vehicleid),vx,vy,vz);
		if(GetCreatorID(vehicleid)!=0)
		{
		if(strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid)) || PlayerToPoint(5, playerid,vx,vy,vz))
		{
		PlayerActionMessage(playerid,15.0,"locks the vehicle.");
		VehicleSystem[GetCreatorID(vehicleid)][locked] = 1;
		SaveTool();
 		}
		else
		{
 		}}
		else
		{
 		SendClientMessage(playerid,COLOR_GREY,"You're not near your vehicle!");
 		}
		return 1;
		}
Reply


Forum Jump:


Users browsing this thread: