18.12.2016, 15:09
It's me again, feeling like a huge idiot.
I have this really.. really messy command that i have no idea how to make work and was wondering if i could get some help. I basically want it so that you type /breaklock beside a car and you start to break the lock, if it fails then you loose a screwdriver and if it's successful then the doors of the car unlock.
Anyways, that's what i want and here's the really messy code. I apologise in advance
I have this really.. really messy command that i have no idea how to make work and was wondering if i could get some help. I basically want it so that you type /breaklock beside a car and you start to break the lock, if it fails then you loose a screwdriver and if it's successful then the doors of the car unlock.
Anyways, that's what i want and here's the really messy code. I apologise in advance
Код:
CMD:breaklock(playerid, params[]) { GetPlayerDistanceFromPoint(playerid, Positions[0][0], Positions[0][1], Positions[0][2]); GetVehicleDistanceFromPoint(vehicleid, Positions[1][0], Positions[1][1], Positions[1][2]); if(Positions[1][0] > 5 && Positions[1][1] > 5 && Positions[1][2] > 5) return SendClientMessage(playerid, COLOR_GRAD1, "I'm afraid you're too far away!"); if(PlayerInfo[playerid][pScrewdriver] != 1) return SendClientMessage(playerid, COLOR_GRAD1, "You need a screwdriver to access this command!"); if(PlayerInfo[playerid][pScrewdriver] >= 1) { new randnum = Random(1, 100); if(randnum >= 1 && randnum <= 49) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF} You have failed to unlock this car and the screwdriver broke!"); PlayerInfo[playerid][pScrewdriver] = -1; return 1; } if(randnumb >= 50) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF} You've successfully broken the cars lock!"); PlayerVehicleInfo[ownerid][pvLocked] = 0; } } return 1; }