05.04.2018, 16:48
Quote:
Serнa algo como esto
El valor de TRAMID es el id del coche en tu server, el que te de el /dl. El cуdigo es tan sencillo gracias a la funciуn IsVehicleSeatOccupied, que no es nativa del samp: pawn Код:
|
Код:
#define TRAMID 2 AddStaticVehicleEx(449,-2006.9436, 211.0592, 27.5391, 0.0, 0, 1, 1); CMD:tranvia(playerid, params[]) { new Float:x, Float:y, Float:z; GetVehiclePos(TRAMID, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z)) { PutPlayerInVehicle(playerid, TRAMID, 0); } else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos."); return 1; } CMD:subirtranvia(playerid, params[]) { new Float:x, Float:y, Float:z; GetVehiclePos(TRAMID, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z)) { if(!IsVehicleSeatOccupied(TRAMID, 1)) PutPlayerInVehicle(playerid, TRAMID, 1); if(!IsVehicleSeatOccupied(TRAMID, 2)) PutPlayerInVehicle(playerid, TRAMID, 2); if(!IsVehicleSeatOccupied(TRAMID, 3)) PutPlayerInVehicle(playerid, TRAMID, 3); if(!IsVehicleSeatOccupied(TRAMID, 4)) PutPlayerInVehicle(playerid, TRAMID, 4); if(!IsVehicleSeatOccupied(TRAMID, 5)) PutPlayerInVehicle(playerid, TRAMID, 5); SendClientMessage(playerid, 0x02b1afFF, "* Has subido al tranvнa. Para salir usa /salirtranvia."); } else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos."); return 1; } CMD:salirtranvia(playerid, params[]) { RemovePlayerFromVehicle(playerid); SetCameraBehindPlayer(playerid); return 1; } stock IsVehicleSeatOccupied(vehicleid,seatid) { if(!GetVehicleModel(vehicleid)) return 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInVehicle(i,vehicleid) && GetPlayerVehicleSeat(i) == seatid) { return 1; } } return 0; }