07.05.2009, 21:54
Ok so, ive been browsing the forums for hours, got some code snippets and started making my /lock command. /lock will work inside the car, but not outside of it.
If anybody could help me out fixing this, I would appreciate it alot.
EDIT:
Heres the pastebin if you guys prefer that
http://pastebin.com/m7123bd54
If anybody could help me out fixing this, I would appreciate it alot.
Код:
if (strcmp("/lock", cmdtext, true, 5) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new carid=GetPlayerVehicleID(playerid); new carid1=GetClosestCar(playerid); if(IsPlayerInAnyVehicle(playerid)) { if(VehicleLocked[carid] == 0) { format(string, sizeof(string), "* %s presses a button inside his/her vehicle and locks their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[carid] = 1; VehicleLockedPlayer[playerid] = carid; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,1); } } else { format(string, sizeof(string), "* %s presses a button inside his/her vehicle and unlocks their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[VehicleLockedPlayer[playerid]] = 0; VehicleLockedPlayer[playerid] = 999; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,0); } } } else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { new Float:x2,Float:y2,Float:z2; GetVehiclePos(VehicleLockedPlayer[playerid], x2, y2, z2); if(VehicleLocked[carid] == 0) { if(PlayerToPoint(5.0,playerid,x2,y2,z2)) { format(string, sizeof(string), "* %s uses his/her key to lock their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[carid] = 1; VehicleLockedPlayer[playerid] = carid; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,1); } } } else if(VehicleLocked[carid1] == 0) { if(PlayerToPoint(5.0,playerid,x2,y2,z2)) { format(string, sizeof(string), "* %s uses his/her key to unlock their vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); VehicleLocked[VehicleLockedPlayer[playerid]] = 0; VehicleLockedPlayer[playerid] = 999; new i; for (i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(carid,i,0,0); } } } } return 1; }
Heres the pastebin if you guys prefer that
http://pastebin.com/m7123bd54