15.04.2011, 07:30
I have this script
This is a script for locking a vehicle which you own and only works if ur near it. And Vehicle[playerid]; is the variable of the car you own. Now what i want is , If i have another car, say Vehicle2[playerid];, Then it has different location (x,y,z) from that of Vehicle[playerid]; , Now what i need is, If we are near Vehicle[playerid]; it should lock the first car and if we are near Vehicle2[playerid];, It should lock the second one, It shouldnt lock both of them. And if we near none of them, It returns. Can u tell how to make it. Thanks
Код:
if(strcmp(cmd, "/pvlock", true) == 0) { if(gPlayercars[playerid] == 1) { new v, Float:vehx, Float:vehy, Float:vehz; v = Vehicle[playerid]; GetVehiclePos(v, vehx, vehy, vehz); if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx, vehy, vehz)) { if(VehicleInfo[playerid][Locked] == 0) { SetVehicleParamsForPlayer(v, playerid, 0, 1); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~r~Car locked!", 3000, 6); VehicleInfo[playerid][Locked] = 1; gVehLocked[v] = 1; return 1; } if(VehicleInfo[playerid][Locked] == 1) { SetVehicleParamsForPlayer(v, playerid, 0, 0); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~g~Car unlocked!", 3000, 6); VehicleInfo[playerid][Locked] = 0; gVehLocked[v] = 0; return 1; } } else { SendClientMessage(playerid, 0xAFAFAFAA, "You are too far away from your vehicle."); return 1; } } else { SendClientMessage(playerid, 0xAFAFAFAA, "You don't own a vehicle."); } return 1; }