09.09.2013, 22:31
Код:
CMD:tow(playerid, params[]) { new vehicle, trailerid; if(sscanf(params,"i", trailerid)) return SendClientMessage(playerid,-1,"USAGE: /tow [trailerid]"); vehicle = GetPlayerVehicleID(playerid); if(!IsTrailerAttachedToVehicle(vehicle)) { AttachTrailerToVehicle(trailerid, vehicle); SendClientMessage(playerid, -1, "You have successfully attached your trailer to your vehicle"); } return 1; }
EDIT: if you don't want with sscanf
Код:
CMD:tow(playerid, params[]) { new vehicle; if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /tow [trailerid]"); vehicle = GetPlayerVehicleID(playerid); if(!IsTrailerAttachedToVehicle(vehicle)) { AttachTrailerToVehicle(strval(params), vehicle); SendClientMessage(playerid, -1, "You have successfully attached your trailer to your vehicle"); } return 1; }